At the time of release build getting error in react native
In your scenario I think you haven't made a js bundle so please make a bundle first by using command from your project root 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
After that move in to your project's android directory using cd android
Before make release build make sure to clean your gradle using ./gradlew clean
And finally run this command ./gradlew assembleRelease -x bundleReleaseJsAndAssets
I have posted a full answer on this issue on here
I have created a react-native app and I have executed after lots of trials. But when i'm editing the content of the app. It is taking time or not updating the content what i have changed on App. Please could you help me on this.
I understand this issue is because of that bundler is not getting update every time. I have to update the bundle also before executing the react-native run-android command.
To update the build execute this below 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
Any one facing react native build issue?
I am trying to generate debug build but its crashing when the app is launched .
The exception has no useful information.
I was facing the same issue with
sudo react-native run-android
But that got resolved after upgrading RN from 0.48 to 0.55(latest Stable Version)
But the crash remain same for the apk generated using
sudo gradlew assembleDebug
The crash is similar to
https://github.com/facebook/react-native/issues/16745
please see screenshot
After so much struggle , finding solutions from different sources , I got to know that assembleDebug is not bundling by itself. So bundle it assets explicitly using below 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/src/main/res/
and then generate build
sudo gradlew assembleDebug
Problem
My RN application is crashing as soon as it starts (in release mode) and I can't figure out why. I'd like to build a debug version of the app that shows the error that is being encountered.
What I tried
react-native bundle --platform android --dev true --entry-file index.android.js \
--bundle-output android/app/src/main/assets/index.android.bundle \
--assets-dest android/app/src/main/res/
./gradlew assembleDebug
When I do this though, the debug build is still reading from the development server.
I have static image in my react-native app accessing via
<Image source={require("../assets/preview-full-img-title-logo#2x.png")} />
in development it is showing well but in production release APK is not showing what can be the reason? I have followed steps mention here.
https://facebook.github.io/react-native/docs/signed-apk-android.html
This is the command that did it for me:
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/
take a look at github issue>
I'm using react-native v0.59.9 with shrinkResources true configuration.
It makes react-native could not find the assets.
Make sure you do not set shrinkResources on android build.gradle unless the new version of react-native support it later on.
I'm using RN 0.61.2
As stated by #made-in-moon here this worked for me:
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/
Verify whether images are in ../res folder or not ${project}/android/app/src/res. If not then you need to copy images in that folder. That can be done using following react 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/src/main/res/
Ideally, this happens in Android when images sizes are larger. Another way to avoid such issues at runtime is to optimize image sizes.
For iOS 14 one can also upgrade to the latest version of react-native 0.63.3
Check the name of the image file or try renaming.In my case, it was the name of the image. I renamed(removed '-' character) the image and it worked.