Hello,
in our android project we updated jackson library to the latest version GitHub - FasterXML/jackson-databind: General data-binding package for Jackson (2.x): works on streaming API (core) implementation(s)
and now it includes module-info.class
file in each jar of the library.
We import 3 dependencies like this:
dependencies {
implementation com.fasterxml.jackson.core:jackson-core:2.12.1
implementation com.fasterxml.jackson.core:jackson-annotations:2.12.1
implementation com.fasterxml.jackson.core:jackson-databind:2.12.1
}
The problem is proguard think this is a valid (or invalid) classes and build fails:
* What went wrong:
Execution failed for task ‘:minifyMobileReleaseWithProguard’.
java.io.IOException: Can’t write [/home/s/develop/projects/ivi4/zengalt-android-ivi/ivi/build/intermediates/shrunk_jar/mobileRelease/minified.jar] (Can’t read [/home/s/.gradle/caches/transforms-3/c79e01a738f9da01ca5a61c74a478473/transformed/jetified-jackson-databind-2.12.1.jar(;;;;;;;;**.class)] (Duplicate jar entry [module-info.class]))
I google similar problems and none of the solutions are for gradle-implementation-imported libraries.
For example,
-injars my.jar(!META-INF/versions/**)
can’t be used, because we don’t import file named my.jar
, instead we import library android-gradle-way by implementation com.fasterxml.jackson.core:ja...
Another solution
task ('proguard', type: ProGuardTask) {
injars 'my.jar', filter: '!META-INF/versions/**'
}
can’t be used too for the same reason.
We use proguard like this:
configurations.all {
resolutionStrategy {
dependencySubstitution {
substitute module('net.sf.proguard:proguard-gradle') with module('com.guardsquare:proguard-gradle:7.0.1')
}
}
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.2") {
exclude module: 'proguard-gradle'
}
}
Project successfully compiles without proguard or without jackson.
Please, help, I’m stuck.