Gradle build errors after updating Android Studio

心已入冬 提交于 2019-11-28 16:48:31

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.

Dulli

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.

Khan M

I had same issue, because my office PC is 32-bit and my home PC is 64 bit. In the local.properties file, I changed

sdk.dir=C:/Program Files/Android/android-studio/sdk

to

sdk.dir=C:/Program Files (x86)/Android/android-studio1/sdk

note the x86 version of Program Files

Took me forever to find it but this was fixed with buddahbrot's suggestion of creating a local.properties file in the root of your project folder to include sdk.dir= followed by the path to the sdk location.

This worked fine before with just ANDROID_HOME set in Windows but in OSX, I needed to specify with sdk.dir.

The most likely cause is the local.properties file is incorrect.

Check in the root folder and app folder for local.properties and make sure they point to the SDK folder. Both files must point to the SDK folder for this to work.

sdk.dir=C:\Users\me\AppData\Local\Android\Sdk

This works for me to get rid of "Try Again" on the top about Gradle errors.

File >> Project Structure >> Project >> Android Gradle Plugin Version = 3.2.1 and Gradle Version 5.1.1 >> Ok >> Apply

Android Studio >> Build >> Make Project

You may get fine, but it will pop-up again for "Update Gradle" I choose "Do not remind me for this project"

Nimisha Patel

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 //
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!