Android Studio Gradle issue upgrading to version 0.5.0 - Gradle Migrating From 0.8 to 0.9 - Also Android Studio upgrade to 0.8.1

后端 未结 8 2295
名媛妹妹
名媛妹妹 2020-11-27 14:41

After upgrade message states:

Failed to refresh Gradle project \'XXX\'
The project is using an unsupported version of the Android Gradle plug-in (0.8.3).
Ve         


        
相关标签:
8条回答
  • 2020-11-27 14:42

    When I updated to Android Studio 1.0 I found that I need to update to use 1.0.0 version of gradle.

    I had

      dependencies {
            classpath 'com.android.tools.build:gradle:1.0.0-rc2'
    

    I changed it to remove the "-rc2"

      dependencies {
            classpath 'com.android.tools.build:gradle:1.0.0'
    
    0 讨论(0)
  • 2020-11-27 14:44

    To fix it, open file called build.gradle in the project root, and change gradle version there to 0.9.+.

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

    To be repeated for each project ;(

    If you then get a message like "Unable to load class 'org.gradle.api.artifacts.result.ResolvedComponentResult".

    Go to you project_folder/gradle/wrapper directory and edit Unable to load class 'org.gradle.api.artifacts.result.ResolvedComponentResult'. file changing the distributionUrl to

    distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
    

    After upgrade to version 0.8.1 (full download and copy SDK folder over), had to have new version of gradle installed by IDE (using the "Fix it" link a couple of time :S ), and modifing the "android" section of the gradle file in project folder from 19.0 to 19.1, as below: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.12.+' } } apply plugin: 'android'

    repositories {
        mavenCentral()
    }
    
    android {
        compileSdkVersion 19
        buildToolsVersion '19.1.0'
    
        defaultConfig {
            minSdkVersion 7
            targetSdkVersion 19
        }
    }
    
    dependencies {
        compile 'com.android.support:appcompat-v7:19.1.+'
        compile 'com.android.support:support-v4:19.1.0'
    }
    
    0 讨论(0)
  • 2020-11-27 14:55

    The most simple Android project has the following build.gradle:

    buildscript {
        repositories {
            mavenCentral()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:0.9.0'
        }
    }
    
    apply plugin: 'android'
    
    android {
        compileSdkVersion 19
        buildToolsVersion "19.0.0"
    }
    

    There are 3 main areas to this Android build file:

    new-build-system user-guide

    0 讨论(0)
  • 2020-11-27 14:57

    hmm I'm getting this error when I try to add this dependency.

    Error:(22) A problem occurred evaluating project ':app'.

    Could not find method classpath() for arguments [com.android.tools.build:gradle:0.9.+] on project ':app'.

    Ok solved it. This line should be part of the build.gradle "in the project root" as stated above, but I did not recognize. Updating the Build tools to 19.03 actually inserted it in automatically.

    0 讨论(0)
  • 2020-11-27 15:00

    I had the same error, but already had

    classpath 'com.android.tools.build:gradle:0.9.+'
    

    set like this, as Cedric Simon suggested. Thanks to the comment of mattblang, I tried to change it to 0.9.0 and refreshed it

    for those who don't know, where the refresh button is, look below:

    enter image description here

    Afterwards I tried what happens when I change it back to 0.9.+ and refresh again...and it still works.

    So I assume, only pressing the refresh button would have sufficed.

    0 讨论(0)
  • 2020-11-27 15:06

    I faced Same problem Migrating into gradle version 1.0.0.. This solution helps me and save the date..

    Update Plugin and Gradle Version Numbers

    The Android Gradle plugin version is typically listed in the top level build.gradle file in the project, and can be updated as follows:

    Let me consider i have version 0.8.. show my build.gradle(project root folder/build.gradle) shows

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

    remove the old version(0.8) and add new version 1.0.0 like this

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

    And also change the gradle/wrapper/gradle-wrapper.properties:

    remove the old distributionUrl and add new url

    distributionUrl=http://services.gradle.org/distributions/gradle-2.2.1-all.zip

    and change the runProguard in project root/app/build.gradle

    BEFORE:

    buildTypes { release { runProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }

    AFTER:

    buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }

    For more information : Migrating gradle Project(click here)

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