Unable to load sample React Native project on Android - react-native

I just started out with learning React Native and was following the official documentation. But 8081 is blocked by McAfee. So i started the JS server on 8069 port. But when i run the project on android using run-android command. I am getting the error in the image below. Can anyone help me out?
error which pops up

Open development menu select DevSettings and add Your development machine ip:port

Related

Metro Bundler does not start (MacOS)

I installed React Native following the requirements in the documentation (https://reactnative.dev/docs/environment-setup) , i got all the simulators working but i have to manually open them everytime i open the project.
If i press m after npm start the following error shows "warn No apps connected. Sending "devMenu" to all React Native apps failed."
(Btw this is my first time using React-Native so sorry if this is a rookie mistake)
Does anyone know any solution ?

Flipper: Hermes debugger cannot connect error: "Debugging connection was closed"

I have downloaded and setup flipper desktop on my windows machine and I am able to run all its features properly including react devtools but somehow hermes debugger doesn't work and shows error message "Debugging connection was closed".
I am using react 16.13.1 and react-native 0.63.2 and I am running app on Samasung Galaxy Note 10 device. Tried multiple thigs suggested by people on internet but nothing seems to work.
Please refer below image
Please help me out.
Start your project with this command:
react-native start --host localhost

Getting error on iOS machine when running react native project through Xcode. Error code is -999

I just finished development on Windows machine for Android device in React Native and when tried to run same code on Mac with Xcode having bundle load issue with could not connect to development server error.
I tried following solution but did not get any success
kill all node (running on 8081 port)
Change in localhost path
For error details please see below image.
As you are not developing app on iOS platform, source code is written & tested on windows so probably there is setup (or config) issue on mac machine.
So to solve this issue install react native on mac machine with same react native version and try again by killing all processes those are running on 8081 port.

console.log doesn't work with react-native

I'm starting with react-native and I'm getting this problem: I can't log to bundler metro server.
If I create my application using create-react-native-app, I can do 'console.log' and value are logged to metro bundler (running on port 8081).
But if I create my application with react-native init <project>, this doesn't work. To make console.log work, I need to open Chrome DevTools and set remote debug in application.
So my question is: is there any way to make native code to log in bundler console with console.log? I don't want to work with 'create-react-native-app' because it uses Expo and 'realm' database doesn't support expo.
I've tried with react-native 0.55.4 and 0.56, both in windows and linux.
You can also see the console.log() outputs using these commands:
$ react-native log-android
$ react-native log-ios
Note: It also works to debug native errors, for example when you have a blank screen and metro bundler doesn't show errors neither.
For more information you can check this out
Don't know if I correctly understand your question (because of my english), but you can try this:
Run adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see
your Android app's logs.
Taken from Using adb logcat for React Native Debugging
You can download React Native Debugger and Open your JS Debugger in development menu. You can see everything into RN Debugger.
I discovered that console.log are omitted from console log if your disable remote debug from the debug menu
On Mac. While on ios simulator Clicked on
Command-d->Stop Debugging
.This made logging work for me.

Run react native for android from shared JS folder

Is there a way to keep my react-native code in a separate folder, and be used by both android and iOS projects?
I currently have an application that exists for iOS and Android. I have a need to use react-native for the application, and am having some issues. I have a 3 folder structure to accomplish this: android, ios, and js. Currently, I have the iOS project working properly, but the android project is where the trouble comes in. When I run the android application on an emulator or device, I get the error Could not connect to development server.
My setup for my Activity is such:
reactRootView = new ReactRootView(this);
reactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.setUseDeveloperSupport(true)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
reactRootView.startReactApplication(reactInstanceManager, "SimpleApp", null);
setContentView(reactRootView);
When I run this, the error window indicates it cannot connect to the server, which is a completely different IP address than my localhost (on computer).
I have tried running on device, and doing the adb reverse command, but the result is the same.
I have also tried adding:
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
preferences.edit().putString("debug_http_host", "localhost:8081").apply();
But this still results in the same error.
Using native code along with JS is a little cumbersome(i dont know if it will work or not) you can create your application for both ios and android by just writing the code once in js using react native.And as for your Could not connect to development server you have to go to the root folder of your app and run react-native start that will run the packager. read through the following link for a tutorial on react-native React-native
Kindly refer to my answer provided in following thread.
Packager not started after running "react-native run-android"
Hope it will help you.