more than one file was found with os independent path androidsupportmultidexversion.txt
因为项目新引入的类库里面有androidx.multidex:multidex:2.0.0包和项目中 com.android.support:multidex:1.0.3冲突。
在网上翻来翻去,说是在manifest文件中application节点下添加
tools:replace="android:appComponentFactory"
android:appComponentFactory="any string"这两句
又有了新的错误,多处重复包体版本错误。说是在gradle.properties文件整天价这两句话
android.enableR8.libraries=false
android.enableR8=false
android.useAndroidX=true
android.enableJetifier=true
最后还是各种报错,提示androidx库与现有的冲突。
使用命令:gradlew :app:dependencies 查看哪些包冲突
其实这个是因为androidx与android support库不能兼容导致的问题。
最后的解决方案就是https://www.jianshu.com/p/f7a7a8765294?tdsourcetag=s_pctim_aiomsg ,将项目构建成androidx库兼容。
把兼容的文件改完,以为一切搞定。结果,又报错Invoke customs are only supported starting with 0 --min api 26,这个就在app的build.gradle文件中android下面添加
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
网友评论