Command 'react-native log-android' stuck at 'Starting Logkitty' - android

I'm trying to run a React Native project and after trying to start it, it produces an error which I'm trying to debug, but while trying to debug that error the command gets stuck.
I've tried using 'react-native log-android' but for some reason it gets stuck at 'Starting logkitty'

I had the same issue and the following solution worked for me.
First make sure you have an adb device connected to your system by running the command adb devices from you terminal and check if any devices get listed under the line: List of devices attached.
Now after running the command react-native log-android, 'Reload' code on your device and the logkitty should start logging fine.

The terminal may keep showing "info Starting logkitty" after npx react-native log-android command.
The log data may appear if present, after navigating through the screens of the project in an android device or emulator which is running the project after npx react-native run-android command.

Related

How to run react-native expo app on multiple emulators?

Does anyone know how to run an expo react-native app on multiple android emulators at once?
I have tried to run the app after running the emulators but it would run only on one emulator.
When I tried 'shift+a' it shows a list of emulators but when I choose the desired emulator it doesn't work.
This is the error 'Couldn't start a project on Android: The emulator (Nexus_S_API_30) quit before it finished opening. You can try starting the emulator manually from the terminal with: emulator #Nexus_S_API_30'
This says the emulator exited even though it is already running.
Install app in all emulator
Open all emulator
Run project from different port
For example
Run 'npx react-native start' for first emulator
Run 'npx react-native start --port 9988' from another terminal for second emulator etc
Open app from emulators
Open developer menu by pressing ctrl + m
Change bundle location to '10.0.2.2:PortNumber' eg : '10.0.2.2:9988'

Ionic Live Reload on emulator or actual device doesn't work

Ionic3 emulate option for android is causing me some issues, i tried to launch the project using Livereload on an emulator and also an actual device using the following code
ionic cordova run android --device -l --debug --address 1**.1**.*.**
Its showing me the following output in console:-
Starting app-scripts server: --address 1**.1**.*.** --port 8100 --
livereload-port 35729
--dev-logger-port 53703 --nobrowser --iscordovaserve --platform android --target cordova - Ctrl+C
to cancel
[20:06:10] watch started ...
[20:06:10] build dev started ...
then the build stops and the process finishes without showing any error.
Is there any extra options need to be given or something to with my ports ?
I use the same command but without the --address flag. I am then prompted to select from a list of IPs. The first one on the list is always the correct one. It works every time!

React Native app: cannot connect to dev server, but the simulator is running - why?

The image describes my current situation properly. Please have a look at it first.
I am running my app on React Native. I have Android simulator on. I give the command to start the app. The app build finishes, but it says that virtual device not found, and in my simulator, if I open the app manually, it says that it cannot connect to Development server. It shows some issues.
Can anyone help?
Try run react-native run-android to connect your app to the emulator
Check USB Debugging is on(mostly running on virtual devices)
Check how you created project(react-native-cli or Expo) and run relevant app run command
Make sure your development server(node.js) is running when you run app. Sometimes it crashes then you have to again run command to run app
If all the step does not solve your issue try to uninstall app from device and run app again. Since react-native is still developing and its wired sometime these tricks works
I was having the same issue in Ubuntu 16.04. In my case the problem was that node packager wasn't running.
To check is packager is running easily you can open the browser and enter
http://localhost:8081/
You must see "React Native packager is running."
If you dont, then you can start packager from console running
react-native start
If you get an error like
" ERROR watch /your/project/path/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-ru ENOSPC"
Then run first
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Then run react-native start again and press the letter R twice in the emulator to reload.
Looking at the screenshot, seems like you don't have adb installed because there is a clear 'adb: not found error'.
Luckily Android studio ships with adb and is present in platform-tools under your Android SDK. (generally in /home/your-user-name/Android/Sdk/)
You only need to use it. Create a symbolic link in '/usr/bin/' or '/usr/local/bin/' depending how you'd like to use it.
Run the command:
sudo ln -s ~/Android/Sdk/platform-tools/adb /usr/local/bin/
After this run the app.

React Native - Error calling AppRegistry.runApplication

When I run a simple "AwesomeProject" app as stated in React Native Getting started page, the app runs on Nexus6 API 23 but error is shown. I also tried the following methods to solve the error:
adb reverse tcp:8081 tcp:8081, but doesn't work.
"react-native start" in command line before running the app but it does not show anything after "Loading Dependency Graph, done."
Running it on Nexus5X API 25 but still error occurs.
How do I solve it?
I found out that by typing:
react-native start --port 8081
in the command line, and running app by opening another cmd shell, I was able to run the app successfully. Thanks.

Choose which android device (emulator or phone) will react-native run-android run on

I am developing a react-native application and every time I want to update the changes to either an actual phone or an emulator, I execute react-native run-android (Sometimes I use the reload functionality in the emulator).
My question is whether there is the possibility to specify in which device/emulator the command will run, since when I have both connected it will run and update the app in the most recently run/plugged.
So I would imagine something like this:
react-native run-android --device=XXXXXX
I have been doing some research and haven't found an answer so far, so I hope someone has a clue about it. Thanks!
If you have just one device, either plugged in or running as emulator:
npx react-native run-android // or if you have a npm script, 'npm run android'
The following is useful if you have multiple devices, either plugged in or running as emulators.
Ensure the devices are plugged in, and get their deviceIds with adb devices, then npx react-native run-android --deviceId [DEVICE_ID]
First, plug the device in, or start the emulator with Android Emulator CLI.
emulator -list-avds will list your avds (android virtual devices), e.g. Pixel_2_API_29
emulator -avd Pixel_2_API_29 or emulator #Pixel_2_API_29 will start a specified device.
emulator -help for more info.
Then, open a new terminal/ tab, run either npx react-native run-android. It will start your app on all android devices, both physical and AVDs.
If you wanted to specify only 1 device (why not run on all of them!):
adb devices, to get list of device IDs, e.g. 1cfe4i231414523
npx react-native run-android --deviceId 1cfe4i231414523
PS: React native getting started guide specifies that you should uninstall react-native, and instead use the package through npx. To uninstall npm rm -g react-native. Now, everytime you want to run react-native, use npx react-native [command]. What npx does is it looks in the local node_modules and runs it from there, as opposed to a possibly outdated global react-native package.
If you go through the docs then you would find that there are two more commands available to start the server and there is no such react-native run-android ---//deviceID command available until now but, you can customize react native code in node_modules to make that command for yourself.
The two commands are:
1)react-native start
2)npm start
Cheers :)

Categories

Resources