EAS build error when doing internal distribution build Android

Viewed 26

I can't locate the issue of why my build is failing. The project is fairly empty for now as I'm just trying to set up a React Native project

    [stderr]    ... 36 more
    [stderr] FAILURE: Build failed with an exception.
    [stderr] * What went wrong:
    [stderr] Execution failed for task ':app:mergeLibDexDebug'.
    [stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
    [stderr]    > There was a failure while executing work items
    [stderr]       > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
    [stderr]          > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
    [stderr]            Type org.reactnative.maskedview.BuildConfig is defined multiple  times:/home/expo/workingdir/build/ReactNativeTest/node_modules/@react-native-community/masked-view/android/build/.transforms/1fede80f5722d6eb9b5a88c8f8c99d86/transformed/classes/classes.dex, /home/expo/workingdir/build/ReactNativeTest/node_modules/@react-native-masked-view/masked-view/android/build/.transforms/2db9fab16a0305b47f184ccd5344fe0e/transformed/classes/classes.dex
    [stderr]            Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
    [stderr] * Try:
    [stderr] > Run with --stacktrace option to get the stack trace.
    [stderr] > Run with --info or --debug option to get more log output.
    [stderr] > Run with --scan to get full insights.
    [stderr] * Get more help at https://help.gradle.org
    [stderr] BUILD FAILED in 7m 16s
    Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

As I'm not sure what is relevant information I'll add as much as possible. Few things I've tried:

  • Doing a prebuild of Android

  • At Path android/app/build.gradle adding:

    defaultConfig {
        multiDexEnabled true //Add this line
    }
    

and

  implementation 'androidx.multidex:multidex:2.0.1'
  • java --version gives:
     java 18.0.2.1 2022-08-18
     Java(TM) SE Runtime Environment (build 18.0.2.1+1-1)
     Java HotSpot(TM) 64-Bit Server VM (build 18.0.2.1+1-1, mixed mode, sharing)
  • ./gradlew --version gives:
------------------------------------------------------------
Gradle 7.3.3
------------------------------------------------------------

Build time:   2021-12-22 12:37:54 UTC
Revision:     6f556c80f945dc54b50e0be633da6c62dbe8dc71

Kotlin:       1.5.31
Groovy:       3.0.9
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          18.0.2.1 (Oracle Corporation 18.0.2.1+1-1)
OS:           Mac OS X 12.5.1 x86_64

package.json file:

{
  "name": "reactnativetest",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo-google-fonts/nunito-sans": "^0.2.2",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-firebase/app": "^15.4.0",
    "@react-native-masked-view/masked-view": "0.2.7",
    "@react-navigation/native": "^6.0.12",
    "@react-navigation/stack": "^6.2.3",
    "expo": "~46.0.9",
    "expo-app-loading": "~2.1.0",
    "expo-cli": "^6.0.5",
    "expo-dev-client": "~1.2.1",
    "expo-font": "~10.2.0",
    "expo-localization": "~13.1.0",
    "expo-splash-screen": "~0.16.2",
    "expo-status-bar": "~1.4.0",
    "expo-updates": "~0.14.5",
    "i18n-js": "^4.1.1",
    "react": "18.0.0",
    "react-dom": "18.0.0",
    "react-native": "0.69.5",
    "react-native-eject": "^0.1.2",
    "react-native-gesture-handler": "~2.5.0",
    "react-native-reanimated": "~2.9.1",
    "react-native-safe-area-context": "^4.3.1",
    "react-native-screens": "~3.15.0",
    "react-native-web": "~0.18.7"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

Error occurs when doing : eas build --profile development --platform android

I have been doing android development on Android Studio without any issues for a year or so. I am not used to React Native yet. Opening project in Expo Go works, but not building it.

0 Answers
Related