导入部分插件会出现androidx 安卓运行真机 报错

报错信息

✘  ~/Desktop/peoject   master ●✚  flutter run -d ce57fc75 --debug

Launching lib/main.dart on NX569H in debug mode...
Initializing gradle... 1.3s
Resolving dependencies...  1.9s
FAILURE: Build failed with an exception.                                
* What went wrong:                                                      
Execution failed for task ':app:preDebugBuild'.                         

> Android dependency 'androidx.core:core' has different version for the compile (1.0.0) 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.
* Get more help at https://help.gradle.org                              
BUILD FAILED in 3s                                                      
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done  3.7s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.

*******************************************************************************************

Gradle task assembleDebug failed with exit code 1

解决方案
找到 Android 根目录 build.gradle

改变gradle版本号3.3.1/ 3.3.2/ 或其他版本

改之前

dependencies {
 classpath 'com.android.tools.build:gradle:3.2.1’
 }

改之后

dependencies {
 classpath 'com.android.tools.build:gradle:3.3.2’
 }

如果问题仍然存在 那么在文件追加

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

你可能感兴趣的:(导入部分插件会出现androidx 安卓运行真机 报错)