Skip to content

Failed Build: Error while merging dex archives #55

@huedaya

Description

@huedaya

I experienced failed build due package name. Here the error I get when using v1.0.12:

ERROR

> Task :app:mergeDexStagsecondStagingsec FAILED
~/project-name/node_modules/react-native-disable-battery-optimizations-android/android/build/.transforms/2f8d9ac22f329154eba2ca6aec913408/classes/classes.dex: D8: Type com.reactlibrary.BuildConfig is defined multiple times: ~/project-name/node_modules/react-native-disable-battery-optimizations-android/android/build/.transforms/2f8d9ac22f329154eba2ca6aec913408/classes/classes.dex, ~/project-name/node_modules/react-native-floating-bubble/android/build/.transforms/4f404a63be8db34e91eef9a57a90a10d/classes/classes.dex
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.
Type com.reactlibrary.BuildConfig is defined multiple times: ~/project-name/node_modules/react-native-disable-battery-optimizations-android/android/build/.transforms/2f8d9ac22f329154eba2ca6aec913408/classes/classes.dex, ~/project-name/node_modules/react-native-floating-bubble/android/build/.transforms/4f404a63be8db34e91eef9a57a90a10d/classes/classes.dex

Related error: https://stackoverflow.com/questions/60507686/type-buildconfig-is-defined-multiple-times

CAUSE
Because the package using default name com.reactlibrary which conflict with other library.

SOLUTION
I manage to make it work by changing 3 files: huedaya@c6d98b6

  • AndroidManifest.xml
  • RNFloatingBubbleModule.java
  • RNFloatingBubblePackage.java

TEMPORARY SOLUTION
For who need quick solution, you can use my fork by changing the package.json:

{
    "dependencies": {
        ...
        "react-native-floating-bubble": "git+https://github.com/huedaya/react-native-floating-bubble",
    }
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions