【问题标题】:Build with exception "Android dependency 'androidx.appcompat:appcompat' has different version for the compile (1.0.1) and runtime (1.0.2) classpath"生成异常“Android 依赖项 'androidx.appcompat:appcompat' 的编译 (1.0.1) 和运行时 (1.0.2) 类路径版本不同”
【发布时间】:2023-03-14 10:51:01
【问题描述】:

构建失败并出现异常:

出了什么问题: 任务 ':app:preDebugBuild' 执行失败。 Android 依赖 'androidx.appcompat:appcompat' 有不同的版本 用于编译(1.0.1)和运行时(1.0.2) 类路径。您应该通过手动设置相同的版本 依赖解析

 Doctor summary (to see all details, run flutter doctor -v):
 [√] Flutter (Channel beta, v1.1.8, on Microsoft Windows [Version 10.0.17763.292], locale en-US)
 [√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
 [√] Android Studio (version 3.3)
 [√] IntelliJ IDEA Ultimate Edition (version 2018.2)
 [√] Connected device (2 available)

【问题讨论】:

标签: flutter


【解决方案1】:

请尝试将以下代码添加到您的 android/build.gradle 文件中

subprojects {
    project.configurations.all {
    resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "28.0.0"
            }
        }
    }
}

请告诉我它是否适合您。 This documentation 会帮助你

希望对你有帮助

【讨论】:

  • 我在中断更新后修复以支持 AndroidX。非常感谢。
  • 我的意思是在我合并以支持 Android-X 后问题消失了
  • @NateZheng 好的谢谢
【解决方案2】:

只需在 build.gradle 中添加以下代码

repositories { maven { url 'https://maven.google.com' } }  

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-26
    • 1970-01-01
    • 2019-08-28
    • 1970-01-01
    • 1970-01-01
    • 2018-12-20
    相关资源
    最近更新 更多