Hello have you experienced this error after generate an apk with command ./gradlew assembleDebug
??
I just see this error after download the apk on my android phone...
"react-native": "~0.61.5",
Hello have you experienced this error after generate an apk with command ./gradlew assembleDebug
??
I just see this error after download the apk on my android phone...
"react-native": "~0.61.5",
The apk that you built is still debug version.
./gradlew assembleDebug
Thats why it still need the metro server to debug and run normally.
If you want to test out a release version of the apk you need to build and run the apk in release mode:
Either, build a signed apk https://reactnative.dev/docs/signed-apk-android or
Let react native run a release variant on your device(you may still need metro server)
react-native run-android --variant=release
If the above command doesn't work try:
react-native run-android --configuration=release
Recently I tried to create and run in windows 10 by referring the link https://reactnative.dev/docs/environment-setup. I too face same issue and I figure out that this is because by default mobile device try to search build in port 8081. So I gave this command to change the port and run npx react-native run-android --port=1234 and it worked.
npx react-native run-android --port=1234
go to android folder ./gradlew clean
and go back to your project
and npx run react-native run-android
I had to add the Android SDK path to my .bash_profile
or .zshrc
:
export ANDROID_SDK=/Users/<username>/Library/Android/sdk export PATH=/Users/<username>/Library/Android/sdk/platform-tools:$PATH
I was facing this problem because I was not starting the Reactive Native service itself.
You can run directly:
react-native start
Metro will give you the option to run on Android.
Beginner in React Native :- For me, I am getting this error because it seems like the build script is looking assets folder inside the Android project.
So, I just created the folder: mkdir android/app/src/main/assets
and ran the command: 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 --verbose
And then when I run npx react-native run-android: I can see my app.js content on android emulator. Woohoo! However, now I am trying to figure out, why are the changes not live! I can see the changes in App.js reflect immediately on iOS simulator, but not on Android emulator. But that should be a seperate thread altogether.
© 2022 - 2024 — McMap. All rights reserved.