6
votes

Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.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.

In Android studio 3.0 on this problem, use the JakeWharton great god butterknife. Please how to deal with this problem, this is no problem on the Android studio 2.3. May be I used the wrong way, please advise, is originally used 8.5.1 version, an error, I upgraded to 8.6.0, found that the problem cannot be solved.

  buildscript {
        repositories {
            jcenter()
            mavenCentral()
            maven {
                url "https://jitpack.io"
            }
            maven {
                url 'https://maven.google.com'
            }
            maven {
                url 'https://dl.google.com/dl/android/maven2/'
            }
        }

        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0-alpha4' 
            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
            classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1+'
            classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0' 
            classpath ("com.tencent.mm:AndResGuard-gradle-plugin:1.2.3") { changing=true } 
           classpath 'com.letv.sarrsdesktop:BlockCanaryExPlugin:0.9.8.3'
        }
    }

    allprojects {
        repositories {
            jcenter()
            mavenCentral()
            maven {
                url "https://jitpack.io"
            }
            maven {
                url 'http://www.idescout.com/maven/repo/'
            }
            maven {
                url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories"
            }
            maven {
                url 'https://maven.google.com'
            }
            maven {
                url 'https://dl.google.com/dl/android/maven2/'
            }
        }

    }


    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v4'
    }

    task printProps << {
        println commandLineProjectProp
        println gradlePropertiesProp
        println systemProjectProp
        println envProjectProp
        println System.properties['system']
    }






apply plugin: 'com.android.application'
//butterknife
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.butterknife'


/**
 * library
 */
dependencies {
      compile 'com.jakewharton:butterknife:8.6.0+'
      apt 'com.jakewharton:butterknife-compiler:8.6.0+'
}
3
Could you add more details regarding what language and android studio version you are using, as well as what you are trying to do and what your build.gradle has in it? This looks like this issue but I can't say for certain that it is the same unless you give more info. - Dr. Nitpick
Use the Android studio 3.0, Java development, didn't use kotlin. - user6412545
Any solution ever found for this? I'm seeing it in AS 3 beta 2 - Adam

3 Answers

5
votes

Downgrade butterknife-gradle-plugin to 8.4 or use 9.0 snapshot.

2
votes

Just remove

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

downgrade butterknifeversion to 8.4.0

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

Don't forget to remove below line

apply plugin: 'me.tatarka.retrolambda'

2
votes
  • Kotlin 1.2.10
  • Gradle 3.0.1
  • Build tools version 27.0.3
  • apply plugin: 'com.android.library'
  • apply plugin: 'kotlin-android-extensions'
  • apply plugin: 'kotlin-android'
  • apply plugin: 'com.jakewharton.butterknife'

In my library project this comment helped me (R2 imports): https://github.com/JakeWharton/butterknife/issues/963#issuecomment-342547601

project's build.gradle:

buildscript {
    repositories {
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
    }
}

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

module's build.gradle:

apply plugin: 'com.jakewharton.butterknife'

...

dependencies {
    compile 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
    kapt 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
}

This way you can use the

apply plugin: 'com.jakewharton.butterknife'