React-Native assembleRelease fails for task ':app:bundleReleaseJsAndAssets'
Solution 1
First:
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
finally build:
./gradlew assembleRelease -x bundleReleaseJsAndAssets
Solution 2
Looks like you haven't made a js bundle so please make a bundle first by using 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
then in your project directory
cd android
Clean your gradle
./gradlew clean
and make a build finally
./gradlew assembleDebug
Try this. Hope it will helps you.
Solution 3
For me the creating the bundle failed, but I noticed this comment by Sahin Elidemir:
just ./gradlew assembleRelease -x bundleReleaseJsAndAssets saved me.
It almost worked for me. What worked at the end was (notice the app:
, which for me it fails without, and a clean
for good measure):
./gradlew clean app:assembleRelease -x bundleReleaseJsAndAssets
Solution 4
Just using ./gradlew --stop
and then ./gradlew assembleRelease
worked for me.
Solution 5
I had the same problem, the solution was :
cd
to yourApp/android folder
run this
./gradlew --stop
and then
./gradlew assembleRelease
This gonna build your app.
After build is done, go to see your application(apk).
android\app\build\outputs\apk\release
Hamid
Cooking mobile stuff with JavaScript, TypeScript, react-native and Swift
Updated on July 20, 2022Comments
-
Hamid almost 2 years
When I run
./gradlew assembleRelease
build is failed with this error:Error:Execution failed for task ':app:bundleReleaseJsAndAssets. > A problem occurred starting process 'command 'node'
I searched on the internet and found some topics about it, but I couldn't solve my problem.
React-Native version: 0.54.0
EDIT:
Now I'm running./gradlew assembleRelease --info
from the terminal instead of Android Studio and I get different error.
Here is the result:> Task :app:processReleaseResources Putting task artifact state for task ':app:processReleaseResources' into context took 0.007 secs. file or directory '**/android/app/libs', not found file or directory '**/node_modules/appcenter-crashes/android/libs', not found file or directory '**/node_modules/appcenter-analytics/android/libs', not found file or directory '**/node_modules/appcenter/android/libs', not found file or directory '**/node_modules/react-native-interactable/lib/android/libs', not found file or directory '**/node_modules/react-native-navigation/android/app/libs', not found file or directory '**/android/app/libs', not found file or directory '**/node_modules/appcenter-crashes/android/libs', not found file or directory '**/appcenter-analytics/android/libs', not found file or directory '**/node_modules/appcenter/android/libs', not found file or directory '**/node_modules/react-native-interactable/lib/android/libs', not found file or directory '**/node_modules/react-native-navigation/android/app/libs', not found Executing task ':app:processReleaseResources' (up-to-date check took 0.035 secs) due to: Task has failed previously. All input files are considered out-of-date for incremental task ':app:processReleaseResources'. Unable do incremental execution: full task run file or directory '**/android/app/libs', not found file or directory '**/node_modules/appcenter-crashes/android/libs', not found file or directory '**/node_modules/appcenter-analytics/android/libs', not found file or directory '**/node_modules/appcenter/android/libs', not found file or directory '**/node_modules/react-native-interactable/lib/android/libs', not found file or directory '**/node_modules/react-native-navigation/android/app/libs', not found file or directory '**/android/app/libs', not found file or directory '**/node_modules/appcenter-crashes/android/libs', not found file or directory '**/node_modules/appcenter-analytics/android/libs', not found file or directory '**/node_modules/appcenter/android/libs', not found file or directory '**/node_modules/react-native-interactable/lib/android/libs', not found file or directory '**/node_modules/react-native-navigation/android/app/libs', not found Aapt2QueuedResourceProcessor is using **/Android/sdk/build-tools/26.0.2/aapt2 Failed to execute aapt com.android.ide.common.process.ProcessException: Failed to execute aapt * * * FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processReleaseResources'. > Failed to execute aapt
It seems gradle is looking for libs folder in all modules, but there are no libs folders in the node modules. It's true, but I don't know why gradle is looking for libs folder. -
abbasalim over 5 yearsthis worked for build debug but './gradlew assembleRelease' give me errors still
-
Will Goodhew over 5 yearsWHen I run this in my cli it is successfully building but the APK is unsigned and when I try and sign the APK via Android studio I am getting the error above
-
Daniel almost 5 yearsThe above almost worked for me, but when I run the build, I get:
Task 'bundleReleaseJsAndAssets' not found in root project
-
Sahin Elidemir almost 5 yearsjust ./gradlew assembleRelease -x bundleReleaseJsAndAssets saved me. Thx
-
hannojg over 4 yearsThey changed to a new npm package npmjs.com/package/@sentry/react-native which I completely missed!
-
Anuj over 4 yearsGetting Task :react-native-firebase-analytics:verifyReleaseResources FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-firebase-analytics:verifyReleaseResources'.
-
Liam Kernighan almost 4 yearsIf you run Windows 10, use cmd with administrator rights (no git bash), make sure that you're using the actual version of @react-native-community/cli, that directory android/app/src/main/assets exists and use yarn react-native bundle instead of react-native bundle
-
punjabi4life over 3 yearsinstall has 3 l in yours
-
Adriatik Gashi over 3 years@punjabi4life didn't saw that 😂
-
Chanaka Amarasinghe almost 3 yearsThis helps a lot