I recently upgraded to Android Studio 1.5. However, after update, Gradle gets stuck at "Refreshing [project] Gradle Project" and never stops.
Previous version of Android Studio worked just fine.
How do I solve this?
I am on an Ubuntu 15.10 64bit machine.
Edit:
So far, I have tried deleting Android Studio from /opt and downloading the latest version. Didnt help.
I also tried removing the ~/.AndroidStudio1.5
directory. To no avail.
This is in my "Event Log"
Gradle sync started
NullPointerException: null
go to
Preferences > Build, Execution > Build Tools > Gradle
and change theGradle Home
path. I had to change mine because it had the wrong value, it was/Applications/Android Studio.app/Contents/gradle/gradle-2.4
and I changed it to/Applications/Android Studio.app/Contents/gradle/gradle-2.8
In your Android Project change gradle-wrapper.properties file, which is in *project/gradle/wrapper:
From:
distributionUrl=https://services.gradle.org/distributions/gradle-2.4-all.zip
To:
distributionUrl=https://services.gradle.org/distributions/gradle-2.8-all.zip
And also change the project build.gradle like below:
In your build.gradle for the project, update your classpath to gradle 1.5.0
Example:
I had the same problem. My JAVA_HOME wasn't set to the right directory. Ehsun Mehranvaris answer is more like a hack, than a solution. I tried to built the android project per terminal with ./gradlew and it told me JAVA_HOME wasn't set correctly.
To get the path of your java enter in terminal:
Set your JAVA_HOME like this in terminal:
After that, I switched to the android project directory in the terminal and did run this command:
This will build your project and in my case it downloaded the latest gradle 2.8 package. Android Studio might download the package itself, if you set the JAVA_HOME correctly. Didn't try that.
Now you can use the default gradle wrapper from Android Studio and don't need to edit any property file manually. You find that at
Preferences > Build, Execution > Build Tools > Gradle