【问题标题】:Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List; Android studio 3错误:无法找到方法 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;安卓工作室 3
【发布时间】:2018-04-08 15:20:25
【问题描述】:

错误:找不到方法 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'。 此意外错误的可能原因包括: Gradle 的依赖项 缓存可能已损坏(这有时会在网络连接后发生 超时。)

重新下载依赖并同步项目(需要网络)。

Gradle 构建过程(守护进程)的状态可能已损坏。停止 所有 Gradle 守护进程都可以解决这个问题。

停止Gradle 构建进程(需要重新启动)。您的项目可能是 使用与其他插件不兼容的第三方插件 项目中的插件或Gradle 请求的版本 项目。

在 Gradle 进程损坏的情况下,您也可以尝试关闭 IDE,然后杀死所有 Java 进程。

这是我的 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'

【问题讨论】:

  • 尝试无效缓存/重启。
  • @MiteshVanaliya。我做到了。但它仍然是“成绩同步问题”。

标签: android gradle android-gradle-plugin


【解决方案1】:

我通过删除 'apply plugin: 'com.jakewharton.butterknife' 解决了我的问题。 不要删除 'classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'。它会报错你之前是 BindView 的所有内容。

【讨论】:

    【解决方案2】:

    在 Android Studio 3.0 中 如果您使用的是黄油刀,请从 gradle 中删除这 2 行

    1) 应用插件:'com.jakewharton.butterknife' 2) 类路径'com.jakewharton:butterknife-gradle-plugin:8.8.1'

    如果您使用的是 lamda,请从 gradle 中删除这 2 行 1)应用插件:'me.tatarka.retrolambda' 2) 类路径'me.tatarka:gradle-retrolambda:3.6.1'

    我通过从 gradle 中删除这行来解决我的问题

    【讨论】:

    • 是的,我通过删除应用插件解决了我的问题:'com.jakewharton.butterknife' 2) 类路径 'com.jakewharton:butterknife-gradle-plugin:8.8.1'。但一切错误。绑定视图错误。你怎么能解决这个问题?删除黄油刀或使用其他版本?
    • @TrịnhMinh 检查我的答案。
    猜你喜欢
    • 2018-04-07
    • 2017-11-20
    • 1970-01-01
    • 2017-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-11
    • 1970-01-01
    相关资源
    最近更新 更多