gradlew assembleRelease command in react-native android is not generating the app-release.apk
The issue is that the new version of react-native bundles the assets under /app/build/intermediates/res/merged/release instead of app/src/main/res
To resolve it, this is what I did
rm -rf android/app/src/main/res/drawable-*
Now bundle assets using this command:
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/
Note the updated --assets-dest
in the above command. Assembling the APK worked ok after that!
react-native run-android --variant=release
I was trying to generate a signed APK following the steps from https://facebook.github.io/react-native/docs/signed-apk-android.html to generate a signed apk.
I had the same issue. Showed error: Duplicate file
for some of my images when I ran ./gradlew assembleRelease
. assembleRelease
seems to cause some problems with drawable-
folders. I deleted all the drawable-
folders from /android/app/src/main/res/
. Then I ran ./gradlew assembleRelease again. Finaly, it generated a signed APK at /android/app/build/outputs/apk/
.