Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is console.log output when running app on android real device in react native

I am currently working on project .In that project,i am prinitng console.log but no messages are printing anywhere.

i am using npm and react-native-cli to run on android real device.

Thanks

like image 889
Muhammad Ashfaq Avatar asked Jan 02 '23 11:01

Muhammad Ashfaq


2 Answers

If you use a simulator, you can press Cmd + M (on Android) or Cmd + D (on IOS) to see the "Debug JS Remotely",

If you use a real device, you should shake the device and you can see the "Debug JS Remotely" option.

"Debug JS Remotely" option will popup Chrome and from there you can use the Developer Tools.

https://facebook.github.io/react-native/docs/debugging

like image 67
Cansel Muti Avatar answered Jan 04 '23 03:01

Cansel Muti


Below are the ways to check the Console messages in React Native. Once you run the application:

For Android:

1) For real device, shake so that you can view the Developer Options. For a simulator, press ⌘M (Mac) or Ctrl+M(Windows) to bring up the same. Press "Debug JS Remotely", which would open Chrome Debugging. You can then view the Console of Chrome's developer tools to check the messages.

2) Open Android Studio, and in the Logcat window for your device/simulator you can view all the messages including Console logs.

For iOS:

1) For real device, shake so that you can view the Developer Options. For a simulator, press ⌘D (Mac) to bring up the same. Press "Debug JS Remotely", which would open Chrome Debugging. You can then view the Console of Chrome's developer tools to check the messages.

like image 37
sparker Avatar answered Jan 04 '23 03:01

sparker