The Gradle failure may have been because of AndroidX ...flutter迁移AndriodX库问题

方法一:将使用到AndroidX库的插件降级到他没有迁移AndroidX的版本
方法二:打开as,The Gradle failure may have been because of AndroidX ...flutter迁移AndriodX库问题_第1张图片在flutter的Android文件夹右键打开如图,如果是灰色,请确认android文件夹内是否包含****(项目名)_android.iml文件,没有的话新建个项目,复制过来就好了,等待build条加载完,很长时间,然后
The Gradle failure may have been because of AndroidX ...flutter迁移AndriodX库问题_第2张图片
点击Migrate to AndroidX,弹出框(勾选是否备份)确认之后点击The Gradle failure may have been because of AndroidX ...flutter迁移AndriodX库问题_第3张图片
点击Do Refactor就可以 因为我迁移过了 所以会按钮灰色,ok!
这时候打包 如果出现Android dependency ‘androidx.core:core’ has different version for the compile (1.0.0) and r… 你在你的Andriod/build.gradle(注意路径 是android文件夹里的 不不不不是app里面的)中加入

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

就可以解决~

你可能感兴趣的:(flutter)