Failed to apply plugin Android Gradle plugin 3.0.0

2019-03-11 13:59发布

Using the latest Android Studio 3.0 Canary 5

Here's the error:

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

Failed to apply plugin [class 'com.android.build.gradle.api.AndroidBasePlugin'] Android Gradle plugin 3.0.0-alpha5 must not be applied to project [path_to_my_project] since version 3.0.0-alpha5 was already applied to this project

Tried: cleaning, rebuilding, opening/closing. Not working.

any ideas ?

[LATER EDIT] Solution: Migrate to Canary 8+ and all should be ok.

7条回答
不美不萌又怎样
2楼-- · 2019-03-11 15:00

Open a terminal and write

./gradlew --stop 

In gradle.properties make sure you don't have funny stuff

Notice that there are no custom jvmargs...

org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=false

Include the google() repo in build.gradle (project one)

there's how mine look like

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {

  repositories {        
    jcenter()
    google()
    maven { url "http://objectbox.net/beta-repo/" }
  }
  dependencies {
    classpath 'io.objectbox:objectbox-gradle-plugin:0.9.12.1'
    classpath 'com.android.tools.build:gradle:3.0.0-alpha5'

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

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
    jcenter()
    google()
    maven { url "http://objectbox.net/beta-repo/" }
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

lastly the support library versions in the app build.gradle file

build.gradle

...
  //----- Support Libs
  implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
  implementation "com.android.support:design:26.0.0-beta2"
  implementation "com.android.support:recyclerview-v7:26.0.0-beta2"
  implementation "com.android.support:cardview-v7:26.0.0-beta2"
...
查看更多
登录 后发表回答