recently reinstalled the system, and then re-installed Android Studio encountered a pit, opened the Studio to create the project prompted gradle project refresh failed to find all kinds of methods, I have seen a lot of solutions on the Internet, some have tried to no effect, the following is my own solution can refer to.
step 1: find the Studio Android directory D:\Android\Android Studio\gradle, copy the downloaded file to the directory
step 2: download the gradle span> version: https://pan.baidu.com/s/1hsKUK6K password: 7 im3
span> p>
part 3: set the proxy address my Settings are as follows (of course you can also try to set No proxy) :
Step 4: restart Android Studio,
if the problem has not been solved, I recommend using the following solution:
thank blogger: span> bear bear children turn from: https://www.jianshu.com/p/43b795895a79 span>
span> p>
different situations will have different solutions, you need to open the log file to find the detailed error information.
C:\Users\{Username}\.AndroidStudio2.1\system\log
1. Mandatory IPV4
add the variables in the environment variable
_JAVA_OPTIONS
set a variable’s value to,
– Djava.net.preferIPv4Stack=true
restart Android Studio, automatic update gradle.
2. Update JDK1.7 to JDK1.8
File-> Other Settings-> Default Project Structure… Delete. Gradle file
delete folder
c:\users\{username}\. Gradle
then restart Android Studiao to update gradle. Open the gradle properties file for the project and add the following configuration items:
org.gradle. Jvmargs = -xmx512m-xx :MaxPermSize=512m
.
5. Set the correct gradle version
File-> Settings
Build,Execution,Deployment-> Build Tools-> Gradle
this solves the Gradle version mismatch problem. 6. Manual synchronous gradle
Tools-> Android-> Sync Project with Gradle Files
7.
Build-> Clean Project
8. Invalidate and Restart
File-> Invalidate Caches/Restart…
Invalidate and Restart
9. Update android SDK
for the problem of not downloading the corresponding version of SDK, download as required.
10. Change the engineering build directory. The grade file
is sometimes Gradle this’ project_name 】 【 ‘project refresh failed: No cached version of the android. View the build: Gradle: 2.10 + available for offline mode.
Encounter this kind of situation will open the project directory of the build. Gradle file, after change
dependencies {
classpath ‘com. Android. View the build: gradle: 2.10 +’
}
open C: \ Users \} {your user name \. Gradle \ caches files, found no below 2.10 directory, under normal circumstances, When you restart Studio, if you don’t, you will re-download the file directory. If you can’t download it normally, just copy it and put it in the directory.
this is just the solution to my problem, maybe you have the same problem as me, I hope this blog can help you.