3
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.

This is my file build.gradle

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.minh.findtheshipper"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        ext.kotlin_version = '1.1.2-4'
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [onesignal_app_id: "c435c556-1f73-4ac6-9c50-11d2c08e803c",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]
    }
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support') {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion '26.0.2'
                }
            }
        }
    }
    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('com.mikepenz:materialdrawer:5.9.2@aar') {
        transitive = true
    }
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.jakewharton:butterknife:8.6.0'
    compile 'com.mikepenz:google-material-typeface:3.0.1.0.original@aar'
    compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'
    compile 'com.facebook.android:facebook-android-sdk:4.27.0'
    compile 'com.sdsmdg.tastytoast:tastytoast:0.1.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.bumptech.glide:glide:4.0.0'
    compile 'com.google.android.gms:play-services-maps:11.4.2'
    compile 'com.google.maps.android:android-maps-utils:0.5'
    compile 'com.google.android.gms:play-services-location:11.4.2'
    compile 'com.google.android.gms:play-services-places:11.4.2'
    compile 'cn.pedant.sweetalert:library:1.3'
    compile 'com.mikepenz:actionitembadge:3.3.1@aar'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.google.firebase:firebase-core:11.4.2'
    compile 'com.google.firebase:firebase-database:11.4.2'
    compile 'com.google.firebase:firebase-messaging:11.4.2'
    compile 'com.github.markushi:circlebutton:1.1'
    compile 'com.onesignal:OneSignal:3.6.5'
    compile 'com.kofigyan.stateprogressbar:stateprogressbar:0.0.6'
    compile 'com.squareup.okhttp3:okhttp:3.9.0'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
}
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'realm-android'
apply plugin: 'com.google.gms.google-services'
2
Try Invalidate caches / restart. - Mitesh Vanaliya
@MiteshVanaliya. I did. But it still "Grade Sync issues". - Trịnh Minh

2 Answers

7
votes

I resolved my problem by removing 'apply plugin: 'com.jakewharton.butterknife'. Do not remove 'classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'. It'll error everything you were BindView before.

1
votes

In Android studio 3.0 If you are using butterknife then remove this 2 lines from gradle

1) apply plugin: 'com.jakewharton.butterknife' 2) classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'

If you are using lamda then remove this 2 lines from gradle 1) apply plugin: 'me.tatarka.retrolambda' 2) classpath 'me.tatarka:gradle-retrolambda:3.6.1'

I resolved my problem by removing this lines from gradle