'error while relaese android react native apk

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



Solution 1:[1]

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'
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ali Amjad Hassan