Error:
➜ cd android && ./gradlew build --warning-mode=all
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> There was a failure while executing work items
> A failure occurred while executing com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform$DexConversionWorkAction
> Failed to process /home/blint/www/react-native/MyDoctor/android/app/build/intermediates/javac/debug/classes
...
Fix:
- add multidex true on
/android/app/build.gradle
android { ... defaultConfig { ... minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled true ...
- uncomment
org.gradle.jvmargs=-Xmx2048m...
on/android/gradle.properties
... # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 ...
- remove build folder on
/android/app/build/
- rerun
npx react-native run-android
or./gradlew build