Reputation: 11642
I created sample project on the fresh installation of the Android Studio v 1.2.1.1 and i faced with this error message:
Gradle project refresh failed in Android Studio 1.2.1.1
See image below:
So i tried to find any solution on the Google and i checked
gradle.properties file
where is:
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
After that i tried to update all SDK libraries using SDK manager
And after that i tried to find issue in settings (see image)
But everything without success. Because in the error description is nothing i don't know what can be wrong and what to repair.
Any idea please?
Many thanks for any help.
Note: Compilaton using Cordova (which is using Gradle too) is without problems and app is compiled.
Upvotes: 3
Views: 15921
Reputation: 1384
buildscript {
repositories {
mavenCentral()
}
dependencies
{
classpath 'com.android.tools.build:gradle:2.3.0'
}
}
allprojects
{
repositories
{
mavenCentral()
}
}
Upvotes: 0
Reputation: 921
File -> Invalidate Caches / Restart -> Invalidate and Restart worked for me.
Upvotes: 0
Reputation: 89
This might be too late to answer. But this may help someone.
In my case there was problem of JDK path.
I just set proper JDK path for Android Studio 2.1
Upvotes: 1
Reputation: 111
For anyone who is struggling with this error, here is my solution:
Step 1) Click in "Android Studio" (upper bar) -> "Preferences" -> "Build, Execution, Deployment" -> "Build Tools" -> "Gradle"
And select "Use local gradle distribution" and find the path for your Gradle file (eg. /Applications/Android Studio.app/Contents/gradle/gradle-2.8)
Step 2) Click in "File" (upper bar) -> "Project Structure" -> Select "app" in the "Modules" section. Then, make sure you have set the Compiler SDK Version and Build Tools Version
Step 3) Open your project -> Open "build.gradle" file and then remove the following lines:
android {
compileSdkVersion XX
buildToolsVersion 'XX.X.X'
}
Step 4) Click in "Sync Project with Gradle Files" button.
Upvotes: 6
Reputation: 1300
I tried multiple solutions for this. Finally, following worked for me.
Android Studio > File(Menu bar) > Settings > Build, Execution, Deployment > Build Tools > Gradle > (In the right pane) Service Directory Path: "Some Path" \ .gradle
Go to "Some Path" and Delete or take back up of .gradle folder .
Cheers :)
Upvotes: 1
Reputation: 2806
This Answer helped me solve my gradle sync problem. https://stackoverflow.com/a/27784297/1157720
Remove .gradle from home directory.
Upvotes: 1
Reputation: 11642
Set chmod to 775 on .gradle dir in the home directory helped to me solved it out.
Upvotes: 0