We have gone through our youth, but we parted in autumn. . .
First put a picture of the current Android Studio version:
PS: To be honest, I don’t really like the marking of this nuggets picture. It’s inconvenient for later synchronization. I’m too lazy to do a picture bed or something. It is still recommended to study with CSDN. Can you give a switch? It’s up to the author to choose whether to add a corresponding image to the picture. mark.
Occupy the building. Before reading the Nuggets, there was a picture loss in the draft box. First post, and then update slowly...
Here we only record some AS problems encountered by individuals and the solutions for successful verification. Of course, each person's environment or other situations are different, and this depends on individual circumstances.
Hope for understanding. . .
1. Git displays garbled characters
This problem has occurred before, mainly because of font reasons, this time try a wave:
After selecting the font, click Apply and Ok, and look back:
2. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
The error log is as follows:
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
Enter the following command in the root directory to view the version information:
- ./gradlew --version
The output is as follows:
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
Modify the JDK version to 11 according to the following path:
- Preferences > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK
Then replace the JDK version in the build:
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.
First look at the exception output:
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.
The main reason for this problem here is that switching between different versions (package names are different) causes the installation to fail to open the startup page correctly on the phone.
Fix solution:
- Click on the little elephant in the picture below to re-synchronize
4. Loading Devices...
First attach the corresponding map:
Android Studio cannot load the corresponding device.
Fix solution:
- Check whether multiple adb is started on the current computer, and observe again after forced exit. Or kill it with adb kill and try again.
Here you need to observe whether "USB debugging" is enabled on the mobile phone. My OPPO and VIVO always have disconnections and need to be turned on again.
Here it depends on individual circumstances.
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
It is suspected that some local configurations cause abnormal access.
The local network connection is normal, and the access is also normal.
My solution:
- Clear all local AS cache configurations, all in hidden files, remember to delete them one by one. If not, just uninstall AS directly, and then delete all of them one by one.
I specifically searched for the 405 reason, let's take a look:
The 405 error generally refers to the request method not allowed
error. This article lists the possible reasons for the error.
Possible reasons for a 405 error are:
- A 302 jump occurs in a POST request, and the request method will be changed when the 302 jump is made. At this time, the server may not recognize it, and a 405 error will be reported.
- The request server directly checks the Method, and the corresponding Response Header will have the message Allow =GET.
- When load balancing or forwarding is performed on the Web Server, the request method is modified and the backend cannot be recognized.
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
Check Use credential helper as follows.
Preferences
-> Version Control
-> Git
-> 勾选 Use credential helper
Operation diagram:
7. Gradle on the right side of Android Studio does not display custom tasks
Close it as follows, restart Android Studio, and build again.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。