hybriteq / react-native-floating-bubble

A simple Facebook Chat Head like bubble for react native
MIT License
203 stars 56 forks source link

Failed Build: Error while merging dex archives #55

Open huedaya opened 1 week ago

huedaya commented 1 week ago

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: https://github.com/huedaya/react-native-floating-bubble/commit/c6d98b6eb8593d42c631eef8f799d59b56389d41

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",
    }
 }
huedaya commented 1 week ago

@janakact