在项目根目录下执行如下命令,将依赖导出到文件:

./gradlew app:dependencies > log_depend.txt

打开上面的​​log_depend.txt​​文件,然后搜索查找版本冲突的库,CTRL+F

androidx.media:medi

Android dependency ‘xxx‘ has different version for the compile错误解决步骤_搜索

Android dependency ‘xxx‘ has different version for the compile错误解决步骤_android_02

根据层级判断出来

在我创建activity、的时候他自动在build.gradle中添加了依赖

 

Android dependency ‘xxx‘ has different version for the compile错误解决步骤_搜索_03

删除掉以后这个 就可以编译运行了