39

I realize that the normal way to disable debugging is by going to the developer menu. The problem is that since I turned on debugging for my app I am testing (React Native & Android emulator) I have been getting a white screen when the app loads with no information on the console and no ability to access the Dev menu to turn off the debugging.

So I am stuck. SInce JS debugging seens to be specific to the App I assume there is SOMEWHERE else either in the emulator or in react that I can turn it off.

Please advise? Thanks

Gotts
  • 1,992
  • 3
  • 21
  • 30
  • 1
    I just discovered that this is meant to open the dev menu from command line adb shell input keyevent 82. The problem is that i still get nothing....like the app is just hanging – Gotts Nov 21 '16 at 12:02

20 Answers20

30

I just had a similar problem - the remote debugger initialization kept crashing my app and I could not disable remote debugging via the in-app GUI.

After having uninstalled the app from the device (or emulator), remote debugging was disabled when I started the app again.

I assume, that the remote debugging flag is saved withtin the app's shared preferences (which get deleted after uninstall).

max.mustermann
  • 2,711
  • 3
  • 18
  • 23
  • 2
    This should be accepted answer. I don't understand why other similar answers are getting downvoted. Ctrl/Cmd + M doesn't work because the app is stuck, OP said it (and I'm having the same issue)... When you (accidentally) turn on Remote Debugging, it's stored inside the application. Resetting the whole simulator is unnecessary, just uninstall the app and build it again. I didn't come across a faster solution. – effeKtSVK Nov 26 '21 at 14:22
19

If you are using on MS : ctrl + m, MAC OS : cmd + m, iPhone/android: shake your device then look for the "disable Remote Debug JS" and click it.

14

Go to your android settings and clear app data and cache and reload the app remote debugging will be turned off.

user13707546
  • 161
  • 1
  • 6
  • isn't there any solution with out disabling the debugger? I need to run in debugging mode to see logs – Mighty May 13 '22 at 08:46
7

The only thing that worked for me (on a Mac) was going to menu bar up top and clicking 'Simulator' and then 'Reset Content and Settings...'. It did reset all the content and settings, though.

knod
  • 416
  • 4
  • 8
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/19083266) – OmG Mar 12 '18 at 21:24
  • 3
    @OmG: Did this not work for you? When I did it, it did reset the debugging, thus disabling it. I didn't find any other way to access any options that would let me do what was requested. If there's something I can clarify, please let me know. – knod Mar 16 '18 at 03:07
  • this worked for me when other solutions did not, thank you. – Shaun Wilson May 07 '20 at 23:16
  • I think instead of reset content... In the same menu, you can choose SHAKE, this will display the ActionSheet (debug menu) in the simulator. From there you can disable debugging – Jaime Sangcap Jan 27 '21 at 21:31
6

Faced the same problem using the Expo app. The app won't start and couldn't access the developer menu and debugging remote js kept crashing the app. The easiest and quickest solution which worked for me was to clear app data in Expo.

Isuru731
  • 61
  • 1
  • 4
5

For those on a Mac using an iOS simulator who cannot do ⌘D because some error has you stuck at an error screen, you can simulate a shake on your simulator with ^⌘z. This will force expo's shelf options open on your simulator and you can disable the debugger, get back into your app and fix whatever you have to fix before getting stuck in your debugger again.

Emanuel Siu
  • 73
  • 1
  • 4
5

Add this to your app's entrypoint

import { NativeModules } from 'react-native';
NativeModules.DevSettings.setIsDebuggingRemotely(false);

This is a poorly documented low-level function that will force the remote debugging to be in one state. Once you're unstuck, I recommend you remove this line, as it can cause your app to go in a loop and/or swallow errors in some strange situations.

Christophe Marois
  • 6,051
  • 1
  • 28
  • 26
4

Sorry this is coming late but it will help others in the future. If you're facing this issue, just uninstall the expo client app on your mobile device or emulator and install the expo app again and it will fix that.

4

just ctrl+m on the emulator and stop debugging

Ahsan Khan
  • 59
  • 2
3

I had to do:

cd android; gradle uninstallDebug; cd ../; react-native run-android
LucasMW
  • 111
  • 6
2

On Mac: Run react-native for ios then, Go to

Simulator->Hardware->Erase all content and settings

Then go to Vscode,

Run without debugging

This made hot reload working for me.

1

You can also use the ⌘D keyboard shortcut when your app is running in the iOS Simulatoror, or ⌘M when running in an Android emulator on Mac OS and Ctrl+M on Windows and Linux.

Saif
  • 1,646
  • 3
  • 20
  • 40
1

You are using on MS : ctrl + m, MAC OS : cmd + m,

iPhone/android: shake your device then look for the "disable Remote Debug JS" and click it.

Abhishek Gurjar
  • 7,330
  • 10
  • 37
  • 44
  • Run the code below, i hope this code work fine : cd android && gradlew clean && cd .. && react-native run-android share edit – Jesse Shangraw Jul 24 '19 at 04:17
1

The best way, if your using an emulator.

  1. Exit out of expo
  2. find the expo app that's located in your emulator and got to the expo settings.
  3. you will see an option to clear cache and storage.
  4. clear them both and then start expo again.
  5. Remote debugging should be turned back off.
tcanbolat
  • 306
  • 3
  • 7
0

Simplest answer is just to Clear Data of expo app, It save the flag in shared preference for debug mode after clearing data it vanish and then after call npm start command it again open in development mode - Work for me perfectly

sushant gosavi
  • 3,272
  • 3
  • 30
  • 50
0

Nothing worked for me.Cold booting the emulator from android studio fixed it for me.

  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/30033620) – marcel h Oct 09 '21 at 11:02
0

I experienced this as well and it was frustrating. I can't access menu since the app was crashing. Either reinstalling the app or clearing app data did the trick for me.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 28 '22 at 16:27
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/31392520) – tjheslin1 Mar 30 '22 at 16:54
0

clear the expo go application data to solve the problem

-1

Easiest way, without reinstalling expo client is:

  1. Long press you App's icon and select App Info (Or go through Settings > Apps)
  2. Go to Storage & Cache
  3. Clear both storage and cache
  4. Open app again from Expo server
bombillazo
  • 278
  • 5
  • 12
-2

Run the code,i hope this code work fine:

cd android && ./gradlew clean && cd .. && react-native run-android

kvadityaaz
  • 1,231
  • 1
  • 12
  • 22
Mohammad Goldast
  • 178
  • 2
  • 3
  • 13