gpt4 book ai didi

android - Android Studio升级到3.0后找不到方法 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'

转载 作者:行者123 更新时间:2023-11-29 16:48:35 25 4
gpt4 key购买 nike

这是我和 friend 在使用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 版本不兼容。
如果 Gradle 进程损坏,您还可以尝试关闭 IDE,然后杀死所有 Java 进程。

我在这里阅读了很多错误及其解决方案,我注意到我更改的事件 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'

最佳答案

删除插件 apply plugin: 'com.jakewharton.butterknife' in android 3.0

改用这个

compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

关于android - Android Studio升级到3.0后找不到方法 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47036240/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com