Gradle build errors after updating Android Studio

前端 未结 11 2192
无人共我
无人共我 2020-12-12 23:30

I just updated Android Studio, and now when I try to build my app, I get the following Gradle error:

Information: Compilation completed with 2 e         


        
相关标签:
11条回答
  • 2020-12-13 00:25

    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.

    0 讨论(0)
  • 2020-12-13 00:26

    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.

    0 讨论(0)
  • 2020-12-13 00:27

    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 //
    
    0 讨论(0)
  • 2020-12-13 00:28

    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

    0 讨论(0)
  • 2020-12-13 00:30

    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

    0 讨论(0)
提交回复
热议问题