把旧项目的jar包放到新项目 Androidx版本时,Gradle异常。
Execution failed for task ':app:checkDebugClasspath'.
> Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Failed to transform file 'xxx.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
> Failed to transform 'xxx.jar' using Jetifier.
修改Gradle到低版本,例如3.1.x可避免该问题出现。
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
...
}
但是在我的项目中,使用3.1.x会出现v4包重复引用。
我的解决方法如下,使用3.3.0以上版本
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
...
}
因为该版本之后可以在gradle.properties中添加
android.jetifier.blacklist=xx.jar
来过滤该jar包,问题解决。