11

I am new in react native. I want to see the logs of my react files. I am using android studio for using react-native project and genny motion as a simulator. Can you please guide me, how can I see the logs or enable android monitor in android studio?

Even I have already install react dev tools from Facebook for debugging the code: https://facebook.github.io/react-native/docs/debugging.html

but not able to get the particular solution

Already visit: How do you debug React Native?

How to do logging in React Native? I have checked so many solutions but it is not working in android 6.0 versions

But not working please guide me, Thanks in Advance

Madhur
  • 1,702
  • 4
  • 23
  • 39
  • if you want lighter solution you can run "react-native log-android" from your command line, but its not as fancy as debug js remotely – Ganesh Cauda Aug 02 '17 at 09:03

3 Answers3

7

If you're using window, you can try hit CTRL+M, else in mac CMD+D to open debugging menu. Once it open, choose REMOTE JS DEBUGGING, it will automatically open chrome browser for you to debug js error. Android studio debugging will work if you're connected on real device.

Eg. of Debugging Menu

Debugging menu

I've found out the answer for genYmotion from How do you debug react-native?. Don't know whether it'll work for you, but worth for try.

For an Android App, if you're using Genymotion you can toggle the menu by pressing ctrl + m, but you may have to enable it in the menu by :

  • Untick untick widget
  • click on debug in chrome

enter image description here

digit
  • 4,479
  • 3
  • 24
  • 43
  • 1
    I am using linux mint so how can i open menu settings.@digit – Madhur Jul 26 '17 at 07:04
  • I'm not very familiar with window and linux. You can try press ctrl+M or alt+M on the geny simulator. – digit Jul 26 '17 at 07:06
  • 1
    Thanks for updating but it is not working , widget is open properly but i want to open remotejs window. is it possible to open only on that case when any error has come? – Madhur Jul 26 '17 at 07:37
  • 1
    Why would you. Opening remotejs window will take time and reload whole application. For me, it wasting my time for debugging. Just let it open and sorry i didn't find any resources related to the linux debugging. – digit Jul 26 '17 at 08:49
  • 1
    its okay..Thanks for the efforts. but n clicking cltr+m or anything nothing works, i was thinking remote js debugging will work in that.. – Madhur Jul 26 '17 at 09:06
  • 1
    Hi from https://meta.stackoverflow.com/questions/299680/how-to-withdraw-the-bounty you cannot withdraw your bounties but you can wait for 7 day until it ending for itself. It's ok, the next 7 day you can tick my answer without having lost your point. – digit Jul 28 '17 at 12:28
0

Now i have resolved the issue with these above comments you can click

Ctrl + D and then click Ctrl + M for fetching the debugging contents

Then Run below command for checking logs

React-native log-android 

with this you will be able to see the console logs in android studio terminal log panel.

But before this you need to run command:

Npm start 

for checking latest changes by fetcing bundle directly in the simulator

Thank you

Madhur
  • 1,702
  • 4
  • 23
  • 39
0

Instead of using simple console.log command

Use Reactoron for Logging Data Here is the link: https://github.com/infinitered/reactotron

Best thing for log in React Native.