React native gradlew assembleRelease - react-native

./gradlew assembleRelease
Task :app:bundleReleaseJsAndAssets FAILED`
tried ./gradlew clean not working latest the version react native 0.70.0

Related

Apply post-install patch-package in react-native app final builds

I have a react-native projet, which we had to do some modifications in a node_module package, my modifications works fine when running my app with npx react-native run-android or expo app, but when building the binaries for android with gradle ( ./gradlew assembleRelease) i can't seem to get my patches to be applied..
Thanks

Task :react-native-location:compileDebugJavaWithJavac FAILED while building apk

I'm trying to build my apk & I'm getting this error while building my release apk in react native. Is there any way to fix this react-native-location error?
I was facing this issue while building my apk in react native. To solve this issue you need to:
1- cd android and then ./gradlew clean
2- then in your root directory run yarn jetify or npx jetify

Not able to build ract-native .apk

project directory: cd android
./gradlew bundleRelease
react-native run-android is working fine, which means dev apk is working on device but, release apk is not build and failed with the above error.
How I can solve this issue?

Process 'command 'npx.cmd'' finished with non-zero exit value 1 React native build problem

I am working on react native. When i try to create a build of android using
gradlew assembleRelease
then getting an
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'npx.cmd'' finished with non-zero exit value 1
But when i create a build using below command build succesfully build
gradlew assembleRelease -x bundleReleaseJsAndAssets
But build not run on mobile device as i am opening my app after install it just crashed.
Also when i try to create build on different System (8gm ram) with same code then it creates build with same command and the build will successfully created. Provide me a solution for this,
use cd android
after that use this ./gradlew clean
and for apk ./gradlew assembleRelease -x bundleReleaseJsAndAssets
or use this for aab ./gradlew bundleRelease -x bundleReleaseJsAndAssets
Try these commands and please tell me if it works
For me, I had to run npm run android once and then ./gradlew assembleRelease worked
UPDATE: Run following command and see output log to find the bug
npx 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
Personally, I had to run the app form within Android Studio.
That gave me a clearer error message which allowed me to fix the issue.
The error in my case had to do with entryFile: "index.android.js", inside app/build.gradle.
I had to change it to index.js since that was the entry point in my RN project.

How to generate apk from a react native project I inherited

I inherited a react native project, the original programmers generated an apk for android, but they are not available anymore.
In the project I see react-native.config.js, package.json and an android folder with gradlew.
For the moment I'd like just to generate apk for android...but I don't know where to start...
You can create an assemble release following these commands. Open up a command line / terminal within you project and run the following commands.
Install node modules.
npm install
Link dependencies.
react-native link
Create the metro bundle.
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
Change the directory to android.
cd android
Clean the Gradle.
gradlew clean
Create the assemble release.
gradlew assembleRelease -x bundleReleaseJsAndAssets
You can find the APK in
PROJECT_PATH\android\app\build\outputs\apk\release
Follow these steps.
perform npm start in your root-dir of project
run npm i in same root-dir of project
can perform react-native link in root-dir location
now cd android
now gradlew assembleRelease
it will generate your .apk file at project_name/android/app/build/outputs/apk/release