gpt4 book ai didi

android - 无法找到方法 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:01:56 26 4
gpt4 key购买 nike

构建.gradle

buildscript {
ext.kotlin_version = '1.1.51'
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'me.tatarka:gradle-retrolambda:3.6.1'
classpath 'com.google.gms:google-services:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

应用程序/build.gradle

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:8.7.0'
}
}


android{
compileSdkVersion = 26
buildToolsVersion = "26.0.2"
defaultConfig {
minSdkVersion = 16
targetSdkVersion = 26

}
...
applicationVariants.all { variant ->

variant.outputs.all { output ->
outputFileName = "newApkName.apk"
}
}
}

如何解决问题:

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.

最佳答案

我在 gradle 同步时遇到了同样的错误,特别是与 butterknife 有关,我的解决方案是通过

https://github.com/JakeWharton/butterknife/issues/963#issuecomment-339545297

tldr 在你的项目构建文件中......

buildscript{
repositories {
//other repos will likely exist here like jcenter and mavenCentral

//add this closure
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:8.7.0'
classpath 'com.android.tools.build:gradle:3.0.0'
//change your version to 9.0.0-SNAPSHOT
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
//.. other project level dependencies
}
}
}

还要确保你的所有项目包括

allproject{
repositories{
maven {
//this
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
}

然后与 butterknife 无关的问题是在您的应用程序构建文件中将我的 buildToolsVersions 升级到 “26.0.2”

2018 年 4 月 19 日更新自此与 butterknife 分道扬镳,因为它造成的问题比我使用过的任何其他第 3 方都多。此外,有了完整的 Kotlin 支持,就不需要 butterknife

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

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