Android Studio 3.0 - Cannot find method 'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs () Ljava / util / List'

Trying to start a new Kotlin project with Android Studio 3.0 Canary 1 displays this error. Full trace:

Error: cannot find method 'Com.android.build.gradle.internal.variant.BaseVariantData.getOutputs () Ljava / Util / List;'. Possible causes of this unexpected error:

  • Gradle's dependency cache may be damaged (this sometimes happens after a network connection timeout.) Dependencies reload and synchronization project (network required).
  • The Gradle state of the build process (daemon) may be corrupted. Stopping all Gradle daemons can solve this problem. Stop Gradle build processes (restart required)
  • Your project may use a third-party plugin that is incompatible with other plugins in the project or version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then destroying all Java processes.

I tried the first two options, and third-party plugins remained by default.

gradle -wrapper.properties

#Thu May 18 08:36:52 BST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip 

build.gradle

 // Top-level build file where you can add configuration options common to all sub-projects/modules. 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 } 

I did not touch any of these values โ€‹โ€‹myself, they are left as the default value. Creating a new project other than Kotlin does not have this problem.

+82
android-studio kotlin
May 18 '17 at 8:41 a.m.
source share
6 answers

In my build.gradle change

ext.kotlin_version = '1.1.2-3'

to

ext.kotlin_version = '1.1.2-4'

fixed it.

(as of November 2017, the current version of Kotlin is 1.1.60)

+174
May 18 '17 at 9:00
source share

It worked for me

Using version 8.4.0

  classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0' 
+2
Sep 14 '17 at 15:27
source share

For java

Just uninstall

classpath 'me.tatarka:gradle-retrolambda:3.7.0'

butterknife version butterknife to 8.4.0

classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'

Do not forget to remove

apply plugin: 'me.tatarka.retrolambda'

from the gradle application level build.

+2
Nov 07 '17 at 7:43 on
source share

This is a known issue in Android Studio Preview 3.0:

If you see this error, perhaps you have an existing version of the Kotlin plugin, which is incompatible with the new Android plugin for Gradle, which is in Android Studio 3.0. The solution is to remove the old Kotlin plugin.

Open the build.gradle file at the project level and find ext.kotlin_version . It should be 1,1,2-4 (or higher). If it shows an older version, you need to remove the old Kotlin plugin so that it does not interfere with the version included with Android Studio 3.0.

On Windows, this should be located at

C:\Users\user_name\AndroidStudio_version\config\plugins\Kotlin\

On a Mac, look

~/Library/Application\ Support/AndroidStudio_version/Kotlin/

+1
Aug 09 '17 at 16:17
source share

In my case, the problem was caused by the fact that we used butterknifegradle-plugin. Upgrading to 8.8.1 did not fix the problem, but, of course, removing it.

build.gradle belongs to the application, so I donโ€™t even know why we use this plugin (I am new to the project)

0
Aug 17 '17 at 9:24 on
source share

Update your kotlin version to the latest version:

 ext.kotlin_version = '1.1.2-4' //currently it the latest version 

You may then encounter some errors, so make sure your buildToolsVersion is โ€œ26.0.2โ€ or higher before resynchronizing.

0
Nov 08 '17 at 9:33 on
source share