gpt4 book ai didi

android - 升级到 Android Studio 3.1 后无法加载类 'com.android.builder.Version'

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:53:16 27 4
gpt4 key购买 nike

我已经在 Canary channel 中升级到 Android Studio 3.1,但我无法再构建我的项目,打印了这个错误:

Unable to load class 'com.android.builder.Version'. 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/caches 目录,但错误仍然存​​在。

寻找类似的错误,我发现旧版本的 Android Studio 在升级 android 工具版本的建议解决方案中存在这个问题。

我想我已经有了最后一个:

    classpath 'com.android.tools.build:gradle:3.1.0-alpha01'

编辑(2017 年 10 月 30 日):

答案表明有人遇到了问题,而有人没有。正如对该问题的评论中所指出的,这可能是由不兼容的插件引起的,因此我在这里列出了我的项目中使用的插件:

buildscript {
ext.kotlin_version = '1.1.51'
repositories {
jcenter()
google()
// maven {
// url 'https://maven.google.com'
// }
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.gradle:build-scan-plugin:1.10"
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.1'
classpath 'com.android.tools.build:gradle:3.1.0-alpha01'
classpath 'com.google.gms:google-services:3.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

由于与较新版本的 Android 插件存在一些不兼容性,目前 dexcount 还没有被严格使用。

最佳答案

我遇到了同样的问题,我们的共同点是 dexcount 插件。在两个插件兼容之前禁用此问题。参见 dexcount bug report .

“更新到 dexcount 0.8.2 解决了这个问题”

关于android - 升级到 Android Studio 3.1 后无法加载类 'com.android.builder.Version',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46971946/

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