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.
Read More:
- [Solved] Android gradle Error: gradle project sync failed. Please fix your project and try again
- android studio Error Gradle project sync failed. Please fix your project and try again
- Error: Gradle project sync failed. Please fix your project and try again.
- Sync with Gradle for project ‘XXXX‘ failed: Connection timed out: connect
- AS3.5 Error gradle project sync failed.Basic functionality(e.g.editing,debugging) will not work
- Could not install Gradle distribution from ‘https://services.gradle.org/distributions/gradle-6.7.1-b
- Error in Cordova project execution command after Android studio upgrade: could not find gradle wrapper within Android SDK
- Android studio “sync project with gradle files” button disappears
- [actual record of Android stepping on the pit] Android studio reports an error invalid gradle JDK configuration found after importing the project
- Import Android project Error:Internal error : org.gradle.tooling .BuildException: Could not execute build…
- [math processing error] problem solving (the difference between F5 refresh page and Ctrl / shift + F5 refresh page)
- Solution: unity package failed. Commandinvocationfailure: gradle build failed
- gradle:failed to find Build Tools revision 29.0.2
- Solve the problems of (deployment descriptor: project name) and (jax-ws web services) under the new eclipse project
- gradle sync failed CreateProcess error=267 directory is invalid
- Gradle sync failed: Sync failed: reason unknown
- Android Studio sync build.gradle appears: Failed to resolve: com.android.support:appcompat problem
- Unity package encountered an error report about gradle build failed
- Quick solution org.gradle.api . tasks.TaskExecutionException : Execution failed for task ‘: app:compileJava ‘
- Finished with error: Gradle task assembleDebug failed with exit code 1