原文链接:https://blog.csdn.net/GeorgeBinDragon/article/details/104905798
迁移到 AndroidX 遇到 jetifier相关问题
项目迁移到AndroidX,需要在工程目录下的gradle.properties文件内,添加 android.enableJetifier=true
Android Studio 3.6.1 ,老项目内的jar包,在编译过程中报错:
Execution failed for task ‘:xxx:javaPreCompileDebug’. Could not resolve all files for configuration ‘:xxx:debugCompileClasspath’.
Failed to transform file ‘old.jar’ to match attributes {artifactType=android-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
Execution failed for JetifyTransform: xxx/old.jar.
Failed to transform ‘xxx/old.jar’ using Jetifier. Reason: Error processing ‘xxx .class’ bytecode… (Run with --stacktrace for more details.)
org.gradle.api.artifacts.transform.ArtifactTransformException: Failed to transform file ‘old.jar’ to match attributes {artifactType=processed-jar} using transform JetifyTransform
Error processing ‘xxx .class’ bytecode.
我希望达到的效果,是既可以使用jetifier将工程迁移到AndroidX,又不需要更改旧的jar包
// 在工程目录下的gradle.properties文件内,添加要屏蔽的jar包的名称
android.jetifier.blacklist = old.jar