react native ./gradlew bundleRelease not working - react-native

enter image description here
i can't build apk and I have this error

Try clean build:
Delete node_modules
npm cache clean –force
npm install
cd android
gradlew clean
gradlew assembleRelease -x bundleReleaseJsAndAssets
if this fails: in root of project:
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
You can track this issue here: https://github.com/facebook/react-native/issues/28510

I fixed it, it was because one of my folder had a space and it tryed to run it as a command

Related

ERROR of Task :app:mergeReleaseResources FAILED

I get a duplicate error after running 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 and consecutively react-native run-android --variant=release.
Deleting the duplicate resources by running rm -rf android/app/src/main/res/drawable-* actually helps. However, my changes doesn't get bundled after deleting those files. Hence, when I run react-native run-android --variant=release again, my changes isn't effected in the build.
Only the drawable_* delete.
android/app/sec/main/res/ and it work.
Or
Generate keystore
Place keystore under your project/android/app/
Edit android/gradle.properties file with your password for keystore
Edit android/app/build.gradle in your project folder and add the
signing config
Run this code in the command line cd android && gradlew
assembleRelease
If you run into a problem in building APK like this error:
Unable to process incoming event 'ProgressComplete ' (ProgressCompleteEvent)
I recommend to
upgrade gradle to 4.3 to avoid building problems
or use Gradlew.bat assembleRelease instead

How To create debug apk file in react native

I have a react native project. it works fine on android. but can not create debug apk file of this project.
first run this command in your terminal
npm run 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/
after this go inside your android folder by running this command
cd android && ./gradlew assembleDebug
then you can get your apk from this location
app/build/outputs/apk/debug/app-debug.apk

How to generate the unsigned apk for android - reac-native

I tried to generate an unsigned apk to install on my other device.
I tried
cd android
then
gradlew assembleRelease
I got an "app-release-unsigned.apk" at android\app\build\outputs\apk\release
I transfered this "app-release-unsigned.apk" to my other android device. Turned on the "install unknown apps". Then installed the "app-release-unsigned.apk", but I got error
App not installed.
Did I missed any steps? Why can't I install this app? I thought for a release, the apk should have everything it need to run my app.
Try this and make sure you have created assets folder :
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 \
&& cd android \
&& ./gradlew clean\
&& ./gradlew assembleDebug
After this you can find your debug apk in
/android/app/build/outputs/apk/debug
Hope it will work .

gradlew assembleDebug generates no changes

Problem
I have just finished making a few changes in my React Native app and on the android emulator when reloading ( R, R) then changes appear.
I then ran the command:
./gradlew assembleDebug
to generate a debug apk.
When I run it on the phone then changes aren't there, it still is an old version.
I have tried:
Deleting the apk in:
./app/build/outputs/apk
Deleting the whole:
./app/build directory
Tried the command:
./gradlew cleanBuildCache
Rebooting after cleaning the cache (3) and deleting the build directory (2)
Tried the command:
gradlew clean
However I still get an old version of the apk generated each time.
I think you must generate the bundle manually since you run the app on your real device.
Unable to load script from assets index.android.bundle on windows
Go to your project directory and check if this folder exists android/app/src/main/assets
If it exists then delete two files viz index.android.bundle and index.android.bundle.meta
If the folder assets don't exist then create the assets directory there.
From your root project directory do
cd android && ./gradlew clean
Finally, navigate back to the root directory and check if there is one single entry file calledindex.js
If there is only one file i.e. index.js then run following command 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
If there are two files i.e index.android.js and index.ios.js then run this 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/src/main/res
Now run react-native run-android

Disabling JS Server from running on react-native run-android command

I perform offline bundling of my react-native project using CMD
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/src/main/res/
As bundinling is done offline i dont want JS server to start each time after running the command react-native run-android.
Is there any way out to avoid starting JS server
Internally, react-native run-android starts the packager and run installDebug task on gradlew.
To just run installDebug, on your project root directory run:
cd android && ./gradlew installDebug