Android plugin 1.3 error

笑着哭i 提交于 2019-12-20 10:25:36

问题


This is error I got when updated my SDK and Build tool to Android M

Android Build Tools
Found incompatible Build Tools and Android plugin versions:
* Module 'app' is using Android plugin 1.2.3 and Build Tools 23.0.0 rc1
Please use Android plugin 1.3 or newer, or an older Build Tools version.
Otherwise the project won't build.

when classpath 'com.android.tools.build:gradle:1.2.3' changed to 1.3

I got another error.

Error:Could not find com.android.tools.build:gradle:1.3.
Searched in the following locations:
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/1.3/gradle-1.3.pom
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/1.3/gradle-1.3.jar
    https://jcenter.bintray.com/com/android/tools/build/gradle/1.3/gradle-1.3.pom
    https://jcenter.bintray.com/com/android/tools/build/gradle/1.3/gradle-1.3.jar

What should I do now ?


回答1:


The was because at that time android gradle plugin 1.3 had not been released yet. It was in beta.

So, try setting the version to 1.3.0-beta1.

You can see the list of all the android grade plugin versions here. Pro tip: scroll all the way down to the bottom so it's easier to see the latest version. :)

Update

Android gradle plugin 1.3 is finally released: https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.0/




回答2:


Update

version 1.4.0-beta1 is now available


Version 1.3.0 of the android gradle plugin is not released yet.

The current latest version (to use with Android-Studio 1.3-preview) is 1.3.0-beta1.

Put this in your root build.gradle

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

You can find the latest published version of the plugin on this page: https://jcenter.bintray.com/com/android/tools/build/gradle/

Note that you may also need to update your build tools :

android {
    buildToolsVersion "23.0.0 rc1"
    ...
}

This version of the build tools is available with the sdk manager under section "Tools (preview channel)"




回答3:


As Android Studio was just officially updated to 1.3 (Gradle as well).

changing gradle version from 1.2.3 to 1.3.+ in build.gradle file worked for me. It should now look like this:

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }



回答4:


Unfortunately, the previous answers above didn't work in my case. Gradle simply freezes while resolving dependencies (I can't find 1.3.0-beta1 in the repo either for manual download):

I had to downgrade the buildToolsVersion from "23.0.0 rc1" to "22.0.1" in the build.gradle (Module: app) and it worked fine afterwards.

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
...


来源:https://stackoverflow.com/questions/30536545/android-plugin-1-3-error

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