【发布时间】:2017-10-31 13:07:09
【问题描述】:
这是我和朋友在使用 Android Studio 2.3.1 时开发的项目。升级到 Android Studio 3.0 后。发生此错误:
Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'.
此意外错误的可能原因包括:
- Gradle 的依赖缓存可能已损坏(这有时会在网络连接超时后发生。)
重新下载依赖并同步项目(需要网络)
- Gradle 构建过程(守护程序)的状态可能已损坏。停止所有 Gradle 守护程序可能会解决此问题。 停止 Gradle 构建过程(需要重新启动)
- 您的项目可能正在使用与项目中的其他插件或项目请求的 Gradle 版本不兼容的第三方插件。
我在这里阅读了很多错误及其解决方案,我注意到我更改 ext.kotlin_version = '1.1.2-4' 的事件没有帮助
这里是 gradle 脚本:
buildscript {
ext.kotlin_version = '1.1.2-4'
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.7.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
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
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir}
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.joinme"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
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.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.google.android.gms:play-services-vision:8.1.0'
compile 'com.android.support:design:23.0.0'
compile 'io.reactivex:rxjava:1.0.14'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'me.itangqi.waveloadingview:library:0.3.5'
testCompile 'junit:junit:4.12'
}
【问题讨论】: