Closed usersina closed 1 year ago
I'm having this issue too. When I try to run a release with ./gradlew bundleRelease
or react-native run-android --variant=release
.
:warning: | Missing Reproducible Example |
---|---|
:information_source: | It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner. |
I fixed it using these steps;
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 assembleRelease -x bundleReleaseJsAndAssets
Source: Stackoverflow
I fixed it using these steps;
- 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 assembleRelease -x bundleReleaseJsAndAssets
Source: Stackoverflow
by using this, apk was created but crashed when open
I fixed it using these steps;
- 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 assembleRelease -x bundleReleaseJsAndAssets
Source: Stackoverflow
by using this, apk was created but crashed when open
Had this exact same issue happen to me. I have created the keystore, updated the values in gradle.properties and app/build.gradle file.
I fixed it using these steps;
- 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 assembleRelease -x bundleReleaseJsAndAssets
Source: Stackoverflow
Thanks.
My problem was that I ran gradlew assembleRelease
from Git Bash on Windows.
I switched from Git Bash to cmd with Administrator rights and entered yarn react-native bundle
instead of react-native bundle
on first step, and it worked.
I faced this issue in window because window system need to install below package. https://www.microsoft.com/en-us/download/details.aspx?id=48145 Install above package and clean project after that run ./gradlew assembleRelase command.
I fixed it using these steps;
- 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 assembleRelease -x bundleReleaseJsAndAssets
Source: Stackoverflow
by using this, apk was created but crashed when open
I have the same issue , any solution ?
Following the official react native publishing tutorial to the point where you have to gradlew bundleRelease
(your app has to be signed)
If that command fails, then:
-Go to android/app/src/main/res
-Delete the drawable(s)
folder(s) and raws
folder
-gradlew clean
then gradlew --stop
just to be safe
-Run gradlew bundleRelease
The build should succeed with your app.aad build file saved under android/app/build/outputs/bundle/release/app.aab
Edit 0: The files being deleted are leftovers that interfere with Task :app:bundleReleaseJsAndAssets
, looking a bit further into the logs shows errors about duplicate assets.
Edit 1: Unless you need an apk
for a very specific reason, using aab
is always a better practice (for a lower app size mainly)
There's some solutions suggested above. Running git bash admin, installing that package. With those is anyone still blocked here?
I was facing the same issue and tried the solutions mentioned above, but nothing helps. Then, I rename my folder, removing the space between the words (eg: "React Native" -> "React-Native") and my problem was solved.
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.
I found this works for me, tell me if it works for you too:
- "@babel/core": "^7.13.14", // & 7.13.13 Android App build failed.
+ "@babel/core": "^7.13.10", // Android App build works fine.
Try to downgrade @babel/core
to v7.13.10, if you are using a newer version
@babel/core
7.13.13, 7.13.14, 7.13.15 all doesn't work for me, and v7.13.10 works!
Also, it happens when you change index.js
to index.tsx
. Go back to .js
.
Just open the project in cmd (administrator mode) in android folder run $ gradlew clean $ gradlew assembleRelease
@usersina's answer has helped me past this issue
Following the [official react native publishing tutorial](https://reactnative.dev/docs/signed-apk-android) to the point where you have to gradlew bundleRelease (your app has to be signed)
If that command fails, then:
-Go to android/app/src/main/res
-Delete the drawable(s) folder(s) and raws folder
cd back into the android folder
- **./gradlew clean** then .**/gradlew --stop** just to be safe
-Run **./gradlew bundleRelease**
The build should succeed with your app.aad build file saved under android/app/build/outputs/bundle/release/app.aab
Edit 0: The files being deleted are leftovers that interfere with Task :app:bundleReleaseJsAndAssets, looking a bit further into the logs shows errors about duplicate assets.
Edit 1: Unless you need an apk for a very specific reason, using aab is always a better practice (for a lower app size mainly)
I'm not sure if this issue is
I had the exact error and all I did was
./gradlew clean
and it build successfully
Try setting bundleInRelease
to false, it worked for me
project.ext.react = [
enableHermes: true,
bundleInRelease: false // Add this line
]
any new solution ??
Try setting
bundleInRelease
to false, it worked for meproject.ext.react = [ enableHermes: true, bundleInRelease: false // Add this line ]
what will this line do?
cd android/ ./gradlew clean ./gradlew bundleRelease
React-native 0.68.2, "react": "17.0.2", node v18.13.0
This works to me!
I'm closing this issue as this is from 2020. If you're experiencing the same issue on React Native 0.71, please open a new issue and we'll look into it.
getting same error in order to get rid of this error
as i am following this article and triggering bunch of errors using this command ./gradlew clean build --refresh-dependencies --no-build-cache
0.71.1
0.63.4
The solution is so simple,
your project ancestors folder names should not contain spaces, like in your error: A:\Documents\React [some ancestor folder with space name]
Try setting
bundleInRelease
to false, it worked for meproject.ext.react = [ enableHermes: true, bundleInRelease: false // Add this line ]
Magic ! thanks.
Try setting
bundleInRelease
to false, it worked for meproject.ext.react = [ enableHermes: true, bundleInRelease: false // Add this line ]
Magic ! thanks.
Where do we have to add this line??
Try setting
bundleInRelease
to false, it worked for meproject.ext.react = [ enableHermes: true, bundleInRelease: false // Add this line ]
Magic ! thanks.
Where do we have to add this line??
you can see it in android/app/build.gradle
I faced this same issue on Mac OS, was related to metro-bundler not having access to the folder in which my project was kept. I restarted my system and re-run the command. The bundler asked for permission to access the folder and after that I was able to generate the build.
Hope it helps. Thanks
@arpansharma7474 @tnson1307 @hustcer @ChawkiOS @KarineValenca
why im getting this error i wan to fix it and generate apk
Task :app:createBundleReleaseJsAndAssets Starting Metro Bundler warning: Bundler cache is empty, rebuilding (this may take a minute) Error: Unable to resolve module .\node_modules\expo\AppEntry.js from D:\New folder (16)\final login\login-app/.: .\node_modules\expo\AppEntry.js could n ot be found within the project or in these directories: node_modules Error: Unable to resolve module .\node_modules\expo\AppEntry.js from D:\New folder (16)\final login\login-app/.: .\node_modules\expo\AppEntry.js could n ot be found within the project or in these directories: node_modules at ModuleResolver.resolveDependency (D:\New folder (16)\final login\login-app\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js: 138:15) at DependencyGraph.resolveDependency (D:\New folder (16)\final login\login-app\node_modules\metro\src\node-haste\DependencyGraph.js:231:43) at D:\New folder (16)\final login\login-app\node_modules\metro\src\lib\transformHelpers.js:156:21 at Server._resolveRelativePath (D:\New folder (16)\final login\login-app\node_modules\metro\src\Server.js:1023:12) at processTicksAndRejections (node:internal/process/task_queues:95:5) at MetroBundlerDevServer.resolveRelativePathAsync (D:\New folder (16)\final login\login-app\node_modules\@expo\cli\src\start\server\metro\MetroBundl erDevServer.ts:1204:12) at MetroBundlerDevServer.metroLoadModuleContents (D:\New folder (16)\final login\login-app\node_modules\@expo\cli\src\start\server\metro\MetroBundle rDevServer.ts:429:35) at MetroBundlerDevServer.legacySinglePageExportBundleAsync (D:\New folder (16)\final login\login-app\node_modules\@expo\cli\src\start\server\metro\M etroBundlerDevServer.ts:552:20) at exportEmbedBundleAndAssetsAsync (D:\New folder (16)\final login\login-app\node_modules\@expo\cli\src\export\embed\exportEmbedAsync.ts:116:21)
at exportEmbedAsync (D:\New folder (16)\final login\login-app\node_modules\@expo\cli\src\export\embed\exportEmbedAsync.ts:68:30)Task :app:createBundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:createBundleReleaseJsAndAssets'.
Process 'command 'cmd'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.
npx react-native info :
System: OS: Windows 10 10.0.19043 CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz Memory: 1.09 GB / 7.88 GB Binaries: Node: version: 20.12.2 path: C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: version: 10.5.2 path: C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels:
package.json: { "name": "login-app", "version": "1.0.0", "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web" }, "dependencies": { "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@expo/metro-runtime": "~3.2.1", "@fontsource/roboto": "^5.0.13", "@mui/icons-material": "^5.15.19", "@mui/material": "^5.15.19", "@mui/styled-engine-sc": "^6.0.0-alpha.18", "@react-native-async-storage/async-storage": "1.23.1", "@react-native-firebase/app": "^19.2.2", "@react-native-firebase/auth": "^19.2.2", "@react-native-masked-view/masked-view": "0.3.1", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@react-navigation/stack": "^6.3.29", "axios": "^1.7.2", "expo": "~51.0.13", "expo-image-picker": "~15.0.5", "expo-local-authentication": "~14.0.1", "expo-navigation-bar": "~3.0.6", "expo-status-bar": "~1.12.1", "firebase": "^10.11.0", "lottie-react-native": "6.7.0", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.74.2", "react-native-fieldset": "^1.0.3", "react-native-gesture-handler": "~2.16.1", "react-native-navigation": "^7.40.0", "react-native-navigation-bar-color": "^2.0.2", "react-native-paper": "^5.12.3", "react-native-swiper": "^1.6.0", "react-native-vector-icons": "^10.0.3", "react-native-web": "~0.19.10", "styled-components": "^6.1.11" }, "devDependencies": { "@babel/core": "^7.24.0", "react-bootstrap": "^2.10.2" }, "private": true }
In my case downgrading the node version from 20 to 16lts worked. it worked for both old builds supporting api level 31 and api level 33 as well.
in my case, all the node modules were not of latest version in my project.
I'm following this to get my signed APK
Description
Executing ./gradlew bundleRelease or ./gradlew assembleRelease however gives an error.
> Task :app:bundleReleaseJsAndAssets warning: the transform cache was reset. Loading dependency graph, done. info Writing bundle output to:, A:\Documents\React info Writing sourcemap output to:, A:\Documents\React info Done writing bundle output info Done writing sourcemap output info Copying 33 asset files error EEXIST: file already exists, mkdir 'A:\Documents\React'. Run CLI with --verbose flag for more details. Error: EEXIST: file already exists, mkdir 'A:\Documents\React'
> Task :app:bundleReleaseJsAndAssets FAILED FAILURE: Build failed with an exception. Execution failed for task ':app:bundleReleaseJsAndAssets'
React Native version:
Binaries: Node: 13.10.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.13.7 - C:\Program Files\nodejs\npm.CMD SDKs: Android SDK: API Levels: 23, 25, 28, 29 Build Tools: 25.0.2, 28.0.3, 29.0.2, 29.0.3, 30.0.0 System Images: android-18 | Google APIs ARM EABI v7a, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom IDEs: Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6241897 npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5
Expected Results
Getting a signed apk file. ./gradlew assembleDebug works with no issues