When running ./android/gradlew assembleRelease
I get the following error:
``` * What went wrong: Execution failed for task \':app:mergeReleaseResources\
Go to the android/app/src/res/
path and then delete all the drawable-hdpi
, mdpi
, xhdpi
, xxhdpi
, xxxhdpi
, raw
folders.
remove all files that have names like node_modules_{some_path}_{imagename}.{extension} or src_images_{imagename}.{extension}
from all the folders in android/app/src/main/res, e.g.
android/app/src/main/res/drawable-xhdpi/node_modules_reactnavigation_src_views_assets_backicon.png android/app/src/main/res/drawable-xhdpi/src_images_mylogo.jpg
The probably got put there by react-native bundle and they cause the duplicate resource error
Had the same error. What I did to resolve it:
Here is the simple solution :
rm -rf $HOME/.gradle/caches/
//apply from: "../../node_modules/react-native/react.gradle"
Delete index.android.bundle
file from assets folder and re-create using react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
run react-native run-android
Or
run react-native run-android --variant=release
Happy Coding..