I am developing an application on react-native. I have a duplicate class issue raised by Gradle when I try to compile my application.
Here is the error log :
Execution failed for task ':app:checkLocalDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class org.apache.commons.io.ByteOrderMark found in modules commons-io-2.4.0.jar (org.lucee:commons-io:2.4.0) and commons-io-2.6.jar (commons-io:commons-io:2.6)
Duplicate class org.apache.commons.io.Charsets found in modules commons-io-2.4.0.jar (org.lucee:commons-io:2.4.0) and commons-io-2.6.jar (commons-io:commons-io:2.6)
... (and many more)
I looked up online solutions, and I want to exclude one dependency, the lower version one, from the build. That way, I think the build will work.
I ran app:dependencies to find which packages are using this duplicate dependency :
--- com.facebook.react:react-native:+ -> 0.63.4
| ...
+--- project :expo-constants
| ...
| \--- commons-io:commons-io:2.6
+--- project :expo-file-system
| ...
| +--- commons-io:commons-io:1.4 -> 2.6
| ...
+--- com.bridgefy:android-sdk:1.1.28
| ...
| +--- org.lucee:commons-io:2.4.0
| ...
Now, I added this to my app/build.gradle file :
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
addUnimodulesDependencies()
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
implementation 'com.android.support:multidex:1.0.3'
// I ADDED THIS LINE BELOW
implementation('com.bridgefy:android-sdk:1.1.28') {
exclude group: 'org.lucee', module: 'commons-io'
}
}
The error doesn't go away with this... I think the module isn't excluded, yet I thought this was the way. How to fix this, please ?
from Fix duplicate classes in android build.gradle
No comments:
Post a Comment