Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle build errors after updating Android Studio

Try adding a new file in the root of your project called "local.properties" (or modify the existing one). It should contain

sdk.dir= 

followed by the path to the sdk location, in my case

sdk.dir=/Applications/Android Studio.app/sdk

I think Android Studio normally creates one automatically but says that it shouldn't be added to VCS. I put it in my .gitignore and cloned the project on my Mac which resulted in this error. Strangely before 0.1.5 it worked just fine without the file.


i have had the Same issue with running Android-Studio on windows XP. After the Update it kept giving me the same error of Gradle: A problem occurred evaluating root project. so what i had to do is:

1- make sure you know where your android studio directory is in my case it was C:\Documents and Settings\UserName\Local Settings\Application Data\Android\android-studio\sdk

2- open the project root directory

3- locate the local.properties file and open it in a text editor notepad did it for me

4- change the sdk.dir="add your SDK directory here without the quotations" and make sure you use double instead of one on each separator sdk.dir=C:\\\Documents and Settings\\\UserName\\\Local Settings\\\Application Data\\\Android\\\android-studio\\\sdk

5- Rebuild your project

That was the only way it worked for me


For me the problem was that in OS X, I need set my ANDROID_HOME to a full path, such as:

export ANDROID_HOME="/Users/username/Development/android-sdk-macosx"

When using the user directory shorthand (~) Gradle seems to consider it a relative directory.


//according to my android studio project folder

just go into local file and open it into notepad then include the following line according to your project sdk file

sdk.dir=C\:/Users/raj/AppData/Local/Android/android-studio/sdk //


As for me ANDROID_HOME didn't work. It shows error that path is not found/exists which is totally stupid. Also I tried to create local.properties with sdk.dir=D:/android/sdk - this also wont work with the same error saying this path does not exist. What helped me - a RELATIVE PATH, so when I set

sdk.dir=../../../android/sdk

it starts to work


For those who are confused by: "This file is automatically generated by Android Studio. # Do not modify this file -- YOUR CHANGES WILL BE ERASED!" when they open local.properties :

It works anyway, if the file is overridden, just change it again.

To easily find the location of your sdk, try: File -> Project Structure -> Android SDK.