com.android.tools.r8.errors.CompilationError: Program type already present: androidx错误解决方法

当通过AndroidStudio运行或者打包的时候报: com.android.tools.r8.errors.CompilationError: Program type already present: androidx…错误的时候,一般是你的依赖中有同一个东西的不同版本造成的。

举个例子:我这边报的是androidx.versionedparcelable.NonParcelField,我们需要做的是定位出引用上面这个包的地方即可,由于项目比较大可以使用命令行:

 ./gradlew app:dependencies

会显示app模块整个的依赖树,搜索关键字versionedparcelable(报错的那个)就可以看到哪块有引用上述的包,统一成一个或者去掉一个即可。

猜你喜欢

转载自blog.csdn.net/codeyanbao/article/details/107979996
今日推荐