How to update gradle in android studio?

前端 未结 14 1986
Happy的楠姐
Happy的楠姐 2020-11-22 09:15

I installed Android Studio 0.1.9. Today I got and update to version 0.2 and of course I updated. After the installation I restarted Android Studio but now I get this messag

相关标签:
14条回答
  • 2020-11-22 09:27

    For me I copied my fonts folder from the assets to the res folder and caused the problem because Android Studio didn't accept capitalized names. I switched to project view mode and deleted it then added it as font resource file by right clicking res folder.

    0 讨论(0)
  • 2020-11-22 09:28

    For those who still have this problem (for example to switch from 2.8.0 to 2.10.0), move to the file gradle-wrapper.properties and set distributionUrl like that.

    distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
    

    I changed 2.8.0 to 2.10.0 and don't forget to Sync after

    0 讨论(0)
  • 2020-11-22 09:31

    Open your root build.gradle file and change Gradle version like this

    Old version:

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

    New version:

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

    For Gradle version compatibility see this.

    0 讨论(0)
  • 2020-11-22 09:32

    Go to File > Settings > Builds,Execution,Deployment > Build Tools > Gradle >Gradle home path

    Now, set Use default gradle wrapper and edit Project\gradle\wrapper\gradle-wrapper.properties files field distributionUrl like this

    distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip

    0 讨论(0)
  • 2020-11-22 09:33

    Select android\gradle\wrapper and open gradle-wrapper.properties

    change: distributionUrl=https://services.gradle.org/distributions/gradle-older-version-to-new-version.zip

    eg: distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip and rebuild your project

    0 讨论(0)
  • 2020-11-22 09:35

    On Mac, open terminal and run the following commands as per instructions:

    $ curl -s https://get.sdkman.io | bash
    

    then

    $ sdk install gradle 3.0
    

    Once the installation is complete, the terminal would ask whether to set it as a default version so type y and make it the default version.

    Now open Android Studio -> Terminal and run the following command

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