25

I have noticed that several people are having issues after upgrading to Android Studio 0.4.3 (problem with 0.4.2 also I believe). My error and debug steps so far are as follows:

The message I see is "Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly" as shown in snapshot below.

Error in Android Studio

I found this thread and following instructions, but I still have the error. I am not able to do the following instruction in the thread: I went into Gradle settings and clicked on "use local Gradle distribution" and pointed it to*: C:/Users/robot_000/.gradle/wrapper/dists/gradle-1.10-all/6vpvhqu0efs1fqmqr2decq1v12/gradle-1.10

Do I need to have a local distribution of gradle? Where do I download it from and where do i put it? How do I now tell Android Studio to use it? (as you can tell, I don't understand how gradle works). Thanks for any help.

Update 1: I found the gradle files on my computer at C:\Users\home.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10, but how do I do do this: "went into Gradle settings and clicked on "use local Gradle distribution" and pointed it to*" (as per THIS THREAD)

user1406716
  • 9,565
  • 22
  • 96
  • 151

7 Answers7

12

Go to File > Settings > Gradle you will end up with this screen for setting up your gradle :

gradle setting

Also make sure you have Google Repository in your Android SDK directory which will be located at :

$SDK_DIR\extras\google\m2repository\com\google\android\gms\play-services\3.1.36

If not do install it from SDK Manager > Extras > Google Repository first.

EDIT :

All your build.gradle(If you are using root level build.gradle to define android gradle plugin version, check in that only) must point to 0.8 version(latest as of now) of android gradle plugin

 dependencies {
     classpath 'com.android.tools.build:gradle:0.8.+'
 }

UPDATED :

Mapping is :

 | Android Gradle Plugin |  Gradle Version |
       0.7.+                     1.9
       0.8.+                     1.10
Piyush Agarwal
  • 25,608
  • 8
  • 98
  • 111
  • Thanks, i found the setting but it did not work. What I had to do was create a completely new project, and use the old files (manually copied) and then run the new project. Not a solution, but it's been a full day i struggled with this, so will give it a rest for now. thanks for the help. – user1406716 Jan 25 '14 at 10:57
  • 1
    Check my edit. After doing these all do sync your project with gradle. If it doesn;t solve your problem follow the steps mention here by Scott once http://stackoverflow.com/questions/21100688/android-studio-0-4-2-suddenly-cannot-resolve-symbols/21100896#21100896 – Piyush Agarwal Jan 25 '14 at 11:19
  • 1
    Deleting the Idea project files and reimporting won't help with this error finding play services. Also, please don't set up a local Gradle distribution in the IDE and point it at something in your .gradle folder; that's a temp folder and it can go away. Using the wrapper is a better way to go than using a local distribution. – Scott Barta Jan 25 '14 at 15:19
  • Also I had to change gradle version number to 1.10 in my gradle wrapper file – netimen Jan 26 '14 at 08:59
  • Yes, But Android Studio if now smart enough to give you an option for auto fix too while syncing with gradle. – Piyush Agarwal Jan 26 '14 at 09:11
4

File -> Invalidate Cache / Restart

Works sometimes for this

Ryan Heitner
  • 13,119
  • 6
  • 77
  • 119
4

I had the same problem and using local gradle distribution didn't work for me either. I ended up finding the solution here Gradle DSL method not found: 'runProguard'

Anything above gradle version 0.14.0 has to use minifyEnabled instead of runProguard in your projects build.gradle file. Here is how it should look :

buildTypes {

    release {

        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

Hope this helps. Check out the link if you are still confused

Community
  • 1
  • 1
  • Thank you. It worked perfectly for me. I was searching and searching for the solution, this was the fitting answer – Nikhil A A May 12 '15 at 05:06
2

I ran into this problem and found I already had the location of Gradle set and already had the Google Repository installed as mentioned by pyus13.

My solution was switching Android SDK Build-tools to a previous version fixed the problem. The latest revision was 19.1, but updating to that broke the tool chain.

It could just be as simple as trying another Build-tools.

SDK Platform-tools and SDK Build-tools

Kyle Falconer
  • 8,302
  • 6
  • 48
  • 68
0

Well i dont know what worked for them but for me worked to add a little scripts to build.gradle. DO note its important to put them at the top of the page (in build.gradle).

buildscript {
    repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.11.2'
}
}

THEN: in buildToolsVersion I had a version 19.1.0 and there for I installed build-tools (SDK manager) version 19.1 & 19. I uninstall other build-tools packetes, im not a fan of useless stuff.

And you should be good to go, hope it helps someone..

Sindri Þór
  • 2,887
  • 3
  • 26
  • 32
0

In the scope of the project, in the gradle properties file, you should add :

org.gradle.jvmargs=-Xmx1024m
GabrielOshiro
  • 7,986
  • 4
  • 45
  • 57
DvxWifiScan
  • 691
  • 5
  • 3
-1

Well, I don't know what worked for them, but for me worked to add little scripts to build.gradle.

Do note that it's important to put them at the top of the page (in build.gradle).

CherryDT
  • 25,571
  • 5
  • 49
  • 74
anakha
  • 1
  • 1