Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expo 52 build fails on Android when expo-haptics is in dependencies (v9.0.0) #259

Open
arndtvoges opened this issue Dec 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@arndtvoges
Copy link

Summary

When using Expo 52 with config plugin 9.0.0 and expo-haptic set as separate dependecy in our package.json, the Android build fails because of duplicate classes.

"expo": "~52.0.14",
"expo-haptics": "~14.0.0",
"@config-plugins/react-native-branch": "^9.0.0",
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeLibDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
   > There was a failure while executing work items
      > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
         > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
           Type expo.modules.haptics.BuildConfig is defined multiple times: /Users/abc/cde/node_modules/@config-plugins/react-native-branch/android/build/.transforms/a6b533ec208fe16ce95ede06ed3ac2c8/transformed/classes/classes_dex/classes.dex, /Users/abc/cde/node_modules/expo-haptics/android/build/.transforms/a3f17f527daa7622ddc6139fd2503168/transformed/classes/classes_dex/classes.dex
           Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.

Adding the following to package.json as a workaround seems to solve the issue:

"expo": {
    "autolinking": {
      "exclude": [
        "expo-haptics"
      ]
    },
  },

Config Plugin

@config-plugins/react-native-branch

What platform(s) does this occur on?

Android

SDK Version

52.0.14

Reproducible demo

Create an Expo 52 project, include the packages above, run development Android build

@arndtvoges arndtvoges added the bug Something isn't working label Dec 5, 2024
@AruSeito
Copy link

AruSeito commented Dec 6, 2024

diff --git a/android/build.gradle b/android/build.gradle
index ed48d73185da82aa645bfcfe1ae299df8dbbb61e..0b508bf59b4c1447c884a8116c706dd43ab3cf95 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -11,7 +11,7 @@ useDefaultAndroidSdkVersions()
 useExpoPublishing()
 
 android {
-  namespace "expo.modules.haptics"
+  namespace "expo.modules.adapters.branch"
   defaultConfig {
     versionCode 5
     versionName '5.0.0'

I used this patch to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants