共计 4562 个字符,预计需要花费 12 分钟才能阅读完成。
咱们走过了青春,却离别在了秋季。。。
先放一张目前 Android Studio 版本图:
PS:说实话不太喜爱这个掘金图片打标记的状况,不不便前期同步,懒得搞图床啥的,还是倡议和 CSDN 学习下,是否给个开关,由作者去抉择是否给图片加对应的标记。
占楼,看了下掘金之前草稿箱呈现图片失落状况,先发文,后续缓缓更新 …
这里仅记录集体遇到的一些 AS 问题以及验证胜利的解决形式,当然每个人环境或者其余状况不太一样,这个看集体状况而定吧。
望体谅。。。
1、Git 显示乱码
之前呈现过这个问题,次要是因为字体起因,这次尝试一波:
抉择字体之后,点击 Apply 并 Ok,再回头看:
2、Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
谬误日志如下:
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
Gradle settings
根目录下输出如下命令查看版本信息:
- ./gradlew –version
输入如下:
Welcome to Gradle 7.0.2!
Here are the highlights of this release:
- File system watching enabled by default
- Support for running with and building Java 16 projects
- Native support for Apple Silicon processors
- Dependency catalog feature preview
For more details see https://docs.gradle.org/7.0.2/release-notes.html
------------------------------------------------------------
Gradle 7.0.2
------------------------------------------------------------
Build time: 2021-05-14 12:02:31 UTC
Revision: 1ef1b260d39daacbf9357f9d8594a8a743e2152e
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_211 (Oracle Corporation 25.211-b12)
OS: Mac OS X 10.16 x86_64
依照如下门路批改 JDK 版本为 11:
- Preferences > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK
随后将 build 中的 JDK 版本做替换:
android {
// ...
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {jvmTarget = '11'}
}
3、Error: Activity class {cn.xxx.xxx/cn.xxx.xxx.SplashActivity} does not exist.
先来看下异样输入:
Error while executing: am start -n "cn.xxx.xxx/cn.xxx.xxx.SplashActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=cn.xxx.xxx/.SplashActivity }
Error type 3
Error: Activity class {cn.xxx.xxx/cn.xxx.xxx..SplashActivity} does not exist.
这里呈现这个问题次要是因为切换不同的版本(包名不一样),导致 install 手机上不能正确关上启动页面。
Fix 计划:
- 点击下图的小象,从新进行一次同步即可
4、Loading Devices…
先附上对应图:
Android Studio 加载不出对应的设施。
Fix 计划:
- 查看以后电脑端 adb 是否启动多个,强制退出后再次察看。或者通过 adb kill 形式干掉,而后再试试。
这里须要察看手机端是否开启「USB 调试」,我这里的 OPPO 以及 VIVO 总是会呈现断线状况,须要从新关上。
这里依据集体状况而定。
5、Received status code 405 from server: Method Not Allowed
Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.3/gradle-3.6.3.pom'. Received status code 405 from server: Method Not Allowed
Disable Gradle 'offline mode' and sync project
狐疑是本地的某些配置,导致拜访不失常。
本地网络连贯失常,拜访也均失常。
自己解决形式:
- 革除本地所有 AS 缓存配置,都在暗藏文件中,记得挨个删除。不行就间接卸载 AS,而后一个个全副删除。
特意搜寻了下 405 起因,一起来看下:
405 谬误个别指申请 method not allowed
谬误,本文列出了呈现该谬误的可能起因。
呈现 405 谬误的可能起因有:
- POST 类申请呈现 302 跳转,302 跳转的时候会更改申请办法此时服务端可能不能辨认,则报 405 谬误。
- 申请服务端间接校验 Method,对应 Response Header 中会有 Allow =GET 的信息字样。
- 负载平衡或者 Web Server 上做转发的时候,批改了申请 Method 导致后端无奈辨认。
6、Invocation failed Unexpected end of file from server
23:55:16.609: git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune
Invocation failed Unexpected end of file from server
java.lang.RuntimeException: Invocation failed Unexpected end of file from server
at org.jetbrains.git4idea.GitAppUtil.sendXmlRequest(GitAppUtil.java:30)
at org.jetbrains.git4idea.http.GitAskPassApp.main(GitAskPassApp.java:58)
Caused by: java.net.SocketException: Unexpected end of file from server
at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:866)
at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:689)
at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:863)
at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:689)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1615)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at org.apache.xmlrpc.DefaultXmlRpcTransport.sendXmlRpc(DefaultXmlRpcTransport.java:87)
at org.apache.xmlrpc.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:72)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:194)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:185)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:178)
at org.jetbrains.git4idea.GitAppUtil.sendXmlRequest(GitAppUtil.java:27)
... 1 more
error: unable to read askpass response from '/Users/heliquan/Library/Caches/Google/AndroidStudio2021.1/tmp/intellij-git-askpass-local.sh'
fatal: could not read Username for 'http://xxx.xxx.cn': Device not configured
按如下勾选 Use credential helper 即可。
Preferences
-> Version Control
-> Git
-> 勾选 Use credential helper
操作示意图:
7、Android Studio 右侧 Gradle 不显示自定义的 task
将如下敞开,并且重启 Android Studio,从新 Build 即可。
8、ing
THK
- Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8
- 申请呈现 405 谬误的起因是什么?