Problem running React Native code on gennymotion emulator - android

"Couldn't start project on Android: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048) could not read ok from ADB Server * failed to start daemon * error: cannot connect to daemo"
I'm getting this error when i try to run my React Native code on gennymotion emulator. As i'm new to react native so i don't know much how to solve this problem.
I write my code on VScode and run on external device and it works perfectly but as i need to debug by code so i have to run it on simulator(I guess).I've downloaded android studio but I dont know what to do with it.It would be great if I get a detailed answer.

Related

RuntimeError Message When Trying to Run App on Android Emulator

This is the error message i keep getting when i try to run app on emulator
RuntimeError: abort(Error: could not connect to TCP port 5554: cannot connect to 127.0.0.1:5554: No connection could be made because the target machine actively refused it. (10061)). Build with -s ASSERTIONS=1 for more info.
What are the best ways to tackle this?
I have tried running my android emulator to test what am building but instead it is showing me those error message

React-native app build successfully but crash on device when opening it

App crash on opening it on android device. Build successfully but raising an error "Failed to connect to development server".
There can be multiple issues with this.
Check that your node package mananger is running close it, connect
your mobile and run the following command.
adb reverse tcp:8081 tcp:8081
npx react-native start
it my solve your problem.
second
if you want wireless debugging, shake your cellphone it will open the debug menu click on the setting , find your ip address witht he command ipconfig/all and then click on Debug server host & port for device enter your IP like this xxx.xxx.xx.xx:8081 and press R from your development server.
Hope this solve your porblem

React Native failed to compile giving Error on the Device

I'm new to the React Native application development. When I after creating project and configured my device, It gives error like below and stop responding.
BUILD SUCCESSFUL in 27s
26 actionable tasks: 1 executed, 25 up-to-date
'C:\Users\Amila' is not recognized as an internal or external command,
operable program or batch file.
info Starting the app (C:\Users\Amila Eranda\AppData\Local\Android
\Sdk/platform-tools/adb shell am start -n
com.awesomeproject/com.awesomeproject.MainActivity...
Starting: Intent { cmp=com.awesomeproject/.MainActivity }
It shows build is success but there is an error on the Device saying
Unable to load script. Make sure you're either running a metro server...
running the adb devices command shows there is a device connected to my PC. But it fails running it in the Device.
That error on your device means that your device cannot connect to the metro server running on your computer to get the js bundle. The app on your device is a temporary app used by react native to quickly download the javascript code from your computer and convert it to code your device can understand each and every time you make changes to your code. Your device must be connected to your computer either on the same wifi network (with metro bundler running in a terminal window on your computer) or through a usb cable (with usb debugging enabled on your device and adb reverse set on a command prompt on your computer).
Read this from the android documentation to find out how to enable developer options on your android device: https://developer.android.com/studio/debug/dev-options
If your android device lets you, you can create a hotspot and have your computer connect to it if you do not have wifi available and usb debugging does not work for you.
Read this from the react native documentation: https://facebook.github.io/react-native/docs/running-on-device#connecting-to-the-development-server-1

React native expo - Reponse timed out

I'm trying to run an app inside my Android emulator and on my Iphone using Expo and Create React Native App.
I' ve ran the following commands to do this.
create-react-native-app MyFirstApp
npm run android
After doing the run command the app runs in the emulator with the following error:
Something went wrong! Could not load *ip*. Network response timed out.
Uncaught error: java.net.SocketTimeoutException: connect timed out.
The same thing happens when I scan the QR code on my Iphone and I can't reach the ip in my web browser.
I've found the following fixes on internet but nothing seems to work:
Add port 19000 to the inbound rules in Windows Firewall
Update Java and npm
npm start instead of npm run android
Edit:
I installed Expo XDE to start the server. It works fine when I use a tunnel but that option is extremely slow when reloading changes. It still doesn't work with localhost or LAN. Is it possible that I have to use something like port forwarding to open this port on my router?
Also: When I typ: localhost:19000 in Google Chrome I get some Json returned. But this doesn't work when I'm in Expo!
Fixed the problem! I just found the following solution:
Go to cmd and type ipconfig
get the ip4 adress of the virtual machine and copy it.
Than go to computer > properties > advanced system settings > environment variables and add the following system variable: REACT_NATIVE_PACKAGER_HOSTNAME
As the value for the variable I had to paste the ip4 of the virtual machine.
I had the same problem. My issue was that VirtualBox had installed a couple of virtual ethernet adapters and NPM was choosing one of those. After disabling those in Control Panel > All Control Panel Items > Network Connections, the Expo app connected as expected.
Windows firewall blocks the request. You can define two inbound rules for Port 19000 and 19001
You can configure the port by defining a .exprc file containing:
{
"manifestPort": 8000
}
I had same issue. I disable all other network adapter and left WIFI adapter enable.
secondly you can also change the priority of adapter it also gonna work

Unable to run Ionic app

I am unable to run my Ionic app in --livereload mode. It gives me an error as:
Error: C:\softwares\android-sdks\platform-tools\adb.exe: Command failed with exit code 1 Error output:
error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon
I started task manager and found 3 adb server are running.I tried to kill them but unable to do that. Please help.
I had same problem while running application with genymotion. I gave the custom path of my sdk in adb settings in configuration of genymotion. And it worked for me.
Also same problem occurs if there is duplication of sdk paths.So you should also check your environment variables for that.

Categories

Resources