Home > Software engineering >  error while relaese android react native apk
error while relaese android react native apk

Time:05-25

I have various problems in relaese apk build. At the moment I solved it by renaming all the library packages and consequently all the imports that give me problems. But I need an idea not to do this every time. Do you have any solutions about it?

The errors if I don't rename the libraries are:

C:\Users\manue\OneDrive\Desktop\MyApp\node_modules\react-native-device-info\android\build.transforms\9166b1d6d34e6b3b03f3d84907b6a605\transformed\classes\classes.dex, C:\Users\manue\OneDrive\Desktop\MyApp\android\app\build\intermediates\external_libs_dex\release\mergeExtDexRelease\classes2.dex

other 7 libraries also give me these errors:

react-native-async-storage-async react-native-sound react-native-background-timer react-native-device-info react-native-splash-screen react-native-google-signin react-native-community-netinfo

CodePudding user response:

Adding the following code to build.gradle app module solved my problem

android{
defaultConfig {

    // Enabling multidex support.
    multiDexEnabled true
}

 dexOptions {
    javaMaxHeapSize "4g"
}
}
dependencies {
//...
compile 'com.android.support:multidex:1.0.0'
}

CodePudding user response:

I have done all the following steps, but I still have the same problems. The errors come out in scale, that is, as soon as I rename the package of this library, it will give me the same error as all the others....

ERROR: Caused by: com.android.tools.r8.utils.b: Type co.apptailor.googlesignin.BuildConfig is defined multiple times: C:\Users\manue\OneDrive\Desktop\MyApp\node_modules@react-native-google-signin\google-signin\android\build.transforms\1e88322511585a5d0650001d078ce1d3\transformed\classes\classes.dex, C:\Users\manue\OneDrive\Desktop\MyAPP\android\app\build\intermediates\external_libs_dex\release\mergeExtDexRelease\classes.dex

Execution failed for task ':app:mergeDexRelease'.

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: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Type co.apptailor.googlesignin.BuildConfig is defined multiple times: C:\Users\manue\OneDrive\Desktop\MyApp\node_modules@react-native-google-signin\google-signin\android\build.transforms\1e88322511585a5d0650001d078ce1d3\transformed\classes\classes.dex, C:\Users\manue\OneDrive\Desktop\MyApp\android\app\build\intermediates\external_libs_dex\release\mergeExtDexRelease\classes.dex

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  • Related