In the past weeks, I have been using react-native run-android to test my android app in android emulator successfully.
Yesterday, I tried to generate a signed APK by following the link https://facebook.github.io/react-native/docs/signed-apk-android.html#content, the signed APK does work in my cellphone.
Today, when I try to run react-native run-android again to test new features in emulator, the packager run successfully, Android emulator report "ReferenceError can't find variable _fbBatchedBridge(line 1 in the generated bundle), when I hit "RELOAD JS", it report "Unable to download JS bundle, did you forget to start development server or connect your device?
I even tried to change the DEV settings by adding the ip:8081, still no luck.
Could anyone help on this, thanks a lot
You need to run this command.
adb reverse tcp:8081 tcp:8081
https://facebook.github.io/react-native/docs/running-on-device.html#method-1-using-adb-reverse-recommended
Related
[How to solve this red emulator error?
(React native app in VScode?][1]
How to solve this red emulator error?
(React native app in VScode?
It's at start project.
I use:
Vscode + yarn android
[1]: https://i.stack.imgur.com/g0RhY.jpg
The adb port doesn't seem to be suitable. You can try the following.
adb reverse tcp:8081 tcp:8081
yarn start
yarn android
Check your navigations, clean gradle and try to run it. Otherwise uninstall it and then again put commands. Check Local properties and paths also.
After the npm start, when the android simulator is open and running with Pixel3, if I 'click' a (for Android emulator), this error appears and the app does not open on the emulator
Trying to open the project on Android...
Installing Expo on device
-Couldn't start project on Android: Error running adb: Failed to install C:\Users\Atif\.expo\android-apk-cache\Exponent-2.16.1.apk:
Expo Press ? to show a list of all available commands.
|
This download is taking longer than expected. You can also try downloading the clients from the website at https://expo.io/tools
I also tried uninstalling and install again. Also I Tried Opening the emulator then run npm start.
Hope Someone Help me. But for whoever helped me i will appreciate their help. Thanks in Advance !!!
first, turn off AVD , then restart start the system, and open AVD and expo project. it will work mostly. If not delete the previous Pixel3 device , restart the system and take a new device and try.
This is because of access issue to open the emulator. Can you manually start a emulator device open, and check react-native run- android. Hopefully if the app is happy, it will install on the emulator.
Anyone here managed to integrate viro-react into react-native project? I followed the instruction in
the documentation
After that, I executed the project but not able to run.
This is the error that I got
Even though I run with gradlew installOvrDebug, still it failed.
If your configurations are correct then try running with any of these variants
ArDebug, GvrDebug or OvrDebug
Example running apllication with Augmented Reality:
Android
react-native run-android --variant=ArDebug
iOS
react-native run-ios --variant=ArDebug
I solved this problem with the following method:
Go to the Navigate to the node_modules/react-native/local-cli/runAndroid/runAndroid.js file and edit the lines that include installDebug change it to installArDebug
Go to the terminal and npm start
Open another terminal and react-native run-android
*Make sure that your device is plugged in and that you have android studio sdk paths in your environment variables. This should do the trick!
I just moved to Ubuntu from Windows 10, I have installed react-native on my laptop and everytime I do react-native init it creates a project as expected. react-native run-android & react-native start commands are working as you'd expect them to be.
My main problem is I just copied a react native project from my Windows 10 machine to Ubuntu and now everytime I do react-native run-android This is the error I see on my console
This is the error I see on my console
Starting JS server...
Running /home/adeel/Android/Sdk//platform-tools/adb reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
The problem was the React Native project was created in Windows and I was trying to run it in a Linux based platform. So what I did was I created a brand new project in my Linux environment and copied my RN code in the newly created project.
This was I believe due to the android file it created which is platform dependent. Windows and Linux have different GRADLE files. I hope this helps anyone who is having this issue.
Seems like it is not recognizing your device/emulator. Run "adb devices" to check. I guess you did the whole Android setup and installed Android Studio (SDK).
I followed this official help page and also consulted this previous SO question.
But I still don't know what is wrong here.
Let's take step by step:
Ensure the package server is running. From the screenshot, you can see the command I typed "react-native run-android" and the reponse "Starting JS server..."
Ensure your device is connected... Yes, Vysor sees my device. Wee see Vysor showing the app running in the screenshot.
...USB enabled Yes, the app is running, that's why we see the red error screen, but it's the app running nevertheless.
Run "adb reverse tcp:8081 tcp:8081" Yes, the screenshot shows that I ran the command.
Device and port... Yes, did that too. See next screenshot
What am I still doing wrong? How can I make it work?
Run npm run start in one console window to start the react-native development server.
Then open a separate console window to run react-native run-android.
I sometimes ran into problems if I don't start the development server in a separate console window.
Further notes:
Make sure that your device is shown if you run $ adb devices in your console.
Note that adb reverse tcp:8081 tcp:8081 only works for Android versions 5.0 and up.
Could you provide us the screenshot of React Packager - run 'npm start' before doing 'react-native run-android'.
I am using Visual Studio Code with React Native tools extension that takes care of port forwarding, deploying the app to device/emulator and it works okay - I get similar screen at start, but clicking 'Reload' takes care of it.
I was stuck at this exact step and finally I checked my firewall and lo and behold it was blocking the connection from my device to my computer. I unblocked it and after a reload everything worked.
Try
adb reverse tcp:8081 tcp:8081
react-native start --reset-cache
react-native run-android