Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'

Tags:

android

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+'
}
like image 441
user6412545 Avatar asked Jun 17 '17 17:06

user6412545


3 Answers

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

like image 184
eyeeaaaa Avatar answered Nov 10 '22 00:11

eyeeaaaa


  • 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'
like image 2
norbDEV Avatar answered Nov 09 '22 23:11

norbDEV


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'

like image 2
Aks4125 Avatar answered Nov 09 '22 22:11

Aks4125