50

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
  • 2,274
  • 3
  • 23
  • 32
  • 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
  • 1
    After so many years this issue still come up. In my case because I accessed the api via ngrok. A "solution" was to clear cache data of Expo Go from the device app manager but should be issued in a better way – Carmine Tambascia Aug 08 '22 at 19:21

25 Answers25

48

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).

Habizzle
  • 2,971
  • 3
  • 20
  • 23
  • 3
    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
  • I had the exact same problem as you, thanks! How come the answer with 35 upvotes is at the bottom? – Scientist1642 Aug 02 '22 at 17:19
  • 1
    @Scientist1642 Me too. Damn, I don't understand why when I press debug remote js my app crashes and can't launch again. It took me a ton of time, luckily found this answer. – Nam Lee Aug 10 '22 at 18:39
  • this is kind of an overkill. within Android, it is enough to clear the app data as well as the cache. Upon reload, the remote debugging will be gone – alfx Sep 24 '22 at 20:26
  • i tried so many thing, doesn't work, restart app, doesn't work, reinstall avd emualtor, doesn't work, reset cache by running expo --clear, doesn't work.... – Pencilcheck Apr 19 '23 at 22:58
27

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.

22

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

user13707546
  • 241
  • 2
  • 6
11

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
  • 111
  • 1
  • 5
11

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,471
  • 1
  • 30
  • 32
8

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
  • 446
  • 5
  • 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

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
  • 83
  • 1
  • 4
5

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.

MEHMET AYDAR
  • 61
  • 1
  • 1
5

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.

kelvin torver
  • 49
  • 1
  • 7
5

just ctrl+m on the emulator and stop debugging

Ahsan Khan
  • 157
  • 2
  • 3
3

I had to do:

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

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
  • 411
  • 6
  • 10
2

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
2

clear the expo go application data to solve the problem

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.

Arar
  • 1,926
  • 5
  • 29
  • 47
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,426
  • 10
  • 37
  • 45
  • 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

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,647
  • 3
  • 35
  • 55
1

Use following steps.

  1. adb kill-server
  2. adb start-server
  3. adb reverse tcp:8081 tcp:8081
0

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
  • 296
  • 2
  • 7
  • 14
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

For some reason the cmd+D was not working unless I press first cmd+option and then cmd+D to show the debugger option and then disable it.

MoNajar
  • 94
  • 1
  • 2
0

On mac:

  1. shift + m 'more tools'
  2. Select 'Toggle developer menu'
  3. A popup will appear on expo go app then select disable debug remote JS
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
learncode
  • 127
  • 6
0

My app was completely crashing when I would run it and the debug browser window would pop open. I was able to nxp react-native start --reset-cache and then I ran the app again with npx react-native start which gave me enough time while it was re-bundling before the app loaded to shake my device and hit Stop Debugging.

0

MAC OS Simulator : cmd + m or shake you device Then Hide inspector

TMD
  • 380
  • 2
  • 8
-3

Run the code,i hope this code work fine:

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

kvadityaaz
  • 1,441
  • 1
  • 16
  • 23
Mohammad Goldast
  • 367
  • 2
  • 4
  • 14