question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android - Bundle release error

See original GitHub issue

Hello all, and forgive me if this isn’t the right place to ask, I’ve already asked on stack overflow with no response.

For some days now I’ve been stuck when trying to bundleRelease my React Native Android app using react-native-svg.

Error

Task :app:transformDexArchiveWithDexMergerForRelease FAILED
java.lang.RuntimeException: java.lang.RuntimeException: 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

I’m aware that this probably isn’t a bug within react-native-svg but I came to ask for help if anyone has ever gone through this.

Apparently there’s 2 or more dependencies trying to use BrushType and it throws this error.

  • I’ve already ran gradlew app:dependencies and can’t find any library referencing Brush, com.horcrux.svg or react-native-svg.
  • Already tried cleaning project, deleting .iml files, invalidating Android Studio caches, rebuilding, reinstalling node_modules and so on
  • Tried messing with build.gradle and gradle.properties with no luck
  • I’ve read through this android guide on duplicate classes also with no luck

I imagine that once I find the libraries using BrushType, I could do something like

implementation(:my-library) {
  exclude ...
}

Correct?

I can’t remember 100%, but somehow I got to suspect that this may be an issue with installing both react-native-svg and react-native-masked-view. Has anyone ever seen this?

Please consider that I only have basic understanding of Android development.

Thanks in advance.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:11

github_iconTop GitHub Comments

12reactions
thiagobrezcommented, Jun 17, 2020

@visheshtungarev In my case, I had to exclude react-native-svg from react-native-jitsi-meet, that was also using the library.

I solved it by adding

implementation(project(':react-native-jitsi-meet')) {
  exclude group: 'com.facebook.react',module:'react-native-svg'
  ...
}

But I think the group path may change, this module was compiled as an external sdk.

2reactions
thiagobrezcommented, Apr 8, 2020

Hey @msand, thanks for the quick reply.

Yeah, I’ve tried that.

  • Already tried cleaning project, deleting .iml files, invalidating Android Studio caches, rebuilding, reinstalling node_modules and so on

Actually, my bundleRelease did pass but it froze (probably crashed) on the splash screen. So I had to give up on Android for now due to tight schedule and I’m working only on refining my iOS app.

I’ll try to make a repro this weekend if I have time, but I don’t really think it’ll happen on a clean new project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create signed bundle release. Error: Android resource linking ...
I am a beginner in java android. The following error occurs when releasing Java project "Create signed bundle" in Android Studio (When I...
Read more >
Android - Bundle release error · Issue #1340 - GitHub
Android - Bundle release error #1340 ... I've been stuck when trying to bundleRelease my React Native Android app using react-native-svg .
Read more >
Solved: Packaging Error in React-Native Release APK
The error means that there is an issue with the bundling of our JS files. It may so happen that your development/debug apk...
Read more >
Known issues with Android Studio and Android Gradle Plugin
This error occurs on Linux-based platforms when starting the native debugger. It indicates that one of the libraries required by the native debugger...
Read more >
Error index.android.bundle in React Native - Qiscus Help
If you got an error in our sample ReactNative `index.android.bundle` after you build your application. You can run this script to fix it:......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found