项目升级AndroidX时编译时报错:The given artifact contains a string literal with a package reference 'android.support.v4.content' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.(给定的项目包含一个带有包引用的字符串文本'安卓支持无法安全重写的.v4.content。使用反射的库(如注释处理器)需要手动更新以添加对androidx的支持。)
这个是你的三方库(注释)依赖错误,请在build.gradle中修改 我遇到的是 butterknife依赖错误,
应修改为支持Androidx的版本
compile 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
要注意的是,你需要在build.gradle 添加JAVA版本指向
在
android {
....
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
最后同步一下就可以了。