please consider that I'm not very familiar with Android development.
Trying to generate the Android signed bundle for my React Native app, I've stumbled upon the following error:
Task :app:mergeDexRelease FAILED
D8: Program type already present: com.horcrux.svg.Brush$BrushType
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at
https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.horcrux.svg.Brush$BrushType
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDexRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.horcrux.svg.Brush$BrushType
BrushType
is a class from react-native-svg
gradlew app:dependencies
and found no module depending on Brush
or anything related to com.horcrux.svg
or react-native-svg
.iml
files, invalidating Android Studio caches, rebuilding, reinstalling node_modules
and so onbuild.gradle
and gradle.properties
with no luckI understand that there are 2 or more dependencies utilizing com.horcrux.svg.Brush$BrushType
but I can't find them. I imagine that once I find them, I could do
implementation(:my-library) {
exclude ...
}
Correct?
android.useAndroidX=true
android.enableJetifier=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2560m
dependencies {
implementation project(':react-native-appearance')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':watermelondb')
implementation project(':react-native-calendar-events')
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
Thanks in advance.
EDIT:
Solved by adding:
implementation(project(':react-native-jitsi-meet')) {
...
exclude group: 'com.facebook.react',module:'react-native-svg'
...
}
In my case it was react-native-jitsi-meet
that was causing the conflicts, I had to find it via trial and error.
defaultConfig {
..............
multiDexEnabled true
}
dependencies {
..............
implementation 'androidx.multidex:multidex:2.0.1'
}
public class MyApplication extends MultiDexApplication {
..............
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With