2019-08-26

作者: lynPositive | 来源:发表于2019-08-26 11:34 被阅读0次

Flutter遇到版本冲突问题

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

我在升级了flutter之后出现了这个问题,在网上找了很多方法都没有用;最后新建立了一个项目,把”pubspec.yaml“中的第三方库一个一个的运行,找到是哪一个库的冲突,然后逐渐改变版本号; 举一个例子:flutter_downloader: ^1.1.9

在终端输入:vi flutter_downloader-1.1.9/android/build.gradle

修改:dependencies {

    implementation('androidx.work:work-runtime:2.0.0')

    implementation 'androidx.annotation:annotation:1.0.0'

    implementation 'androidx.core:core:1.0.0'

    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'

}

中的值为自己需要的

升级,flutter的时候最好也升级下第三库的版本号;不然也可能会有冲突;
https://pub.dev/flutter 可以查到版本号

相关文章

网友评论

    本文标题:2019-08-26

    本文链接:https://www.haomeiwen.com/subject/mjrrectx.html