2017-05-18 1 views
4

I Installieren Sie Android Studio 3.0 Canary 1 und erstellen Sie ein neues Projekt mit Kotlin. Und diesen Fehler:Gradle 3.0.0-alpha1 ist nicht kompatibel mit Kotlin-android Plugin 1.1.2-3?

Error:Unable to find method 'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;'. Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Wenn ich von Kotlin-android-Plugin entfernen build.gradle es erfolgreich bauen wird.

Körperbau gradle:

buildscript { 
    ext.kotlin_version = '1.1.2-3' 
    repositories { 
     maven { url 'https://maven.google.com' } 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0-alpha1' 
     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 

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

allprojects { 
    repositories { 
     jcenter() 
     maven { url 'https://maven.google.com' } 
     mavenCentral() 
    } 
} 

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

app \ build.gradle

apply plugin: 'com.android.application' 
apply plugin: 'kotlin-android' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.3" 
    defaultConfig { 
     applicationId "com.dmytrobazunov.databasetest" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'com.android.support:design:25.3.1' 
} 

Hat jemand knowes, wie dieses Problem zu beheben?

+0

Sie könnten Ihre "doppelte" Antwort verbessern, indem Sie auf die doppelte Frage und Antwort verlinken. Nicht alle von uns haben das gefunden – ErstwhileIII

Antwort

14

Sie müssen die Kotlin-Plugin-Version auf 1.1.2-4 ändern.

+1

Ich habe das gleiche Problem, auch wenn ich diese Kotlin-Version verwendet habe –

1

Dies geschieht, wenn Sie Einstellungen aus einer früheren Version von Android Studio importieren. Bump Ihre Kotlin-Plugin-Version zu 1.1.2-4 und löschen Sie Ordner ~/Library/Application Support/AndroidStudioPreview3.0/Kotlin (wenn Sie mit Mac zum Beispiel)

Verwandte Themen