简体   繁体   English

Android Studio gradle 中的 Flutter 项目问题

[英]Flutter project in Android Studio gradle issue

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.appcompat:appcompat' has different version for the compile (1.0.1) and runtime (1.0.2) classpath. You should manually set the same version via DependencyResolution

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.


BUILD FAILED in 5s

*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.

*******************************************************************************************
Finished with error: 
Gradle task assembleDebug failed with exit code 1

Try below inside your build.gradle在您的build.gradle尝试以下

subprojects {
  project.configurations.all {
     resolutionStrategy.eachDependency { it ->
        if (it.requested.group == 'androidx.appcompat'
              && !it.requested.name.contains('appcompat') ) {
           it.useVersion "1.0.2"
        }
     }
  }
}

Or或者

Change androidx.appcompat:appcompat to version 1.0.2 inside your dependencies {} block.在您的dependencies {}androidx.appcompat:appcompat更改为1.0.2版。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM