How to disable Remote JS Debugging in React-Native
Asked Answered
B

26

52

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

Beekeeping answered 21/11, 2016 at 11:42 Comment(2)
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 hangingBeekeeping
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 wayDetector
H
49

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

Huckaback answered 21/1, 2017 at 15:42 Comment(5)
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.Omsk
I had the exact same problem as you, thanks! How come the answer with 35 upvotes is at the bottom?Sitar
@Sitar 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.Theorbo
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 goneLurk
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....Tanta
T
29

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.

Trilbee answered 5/11, 2018 at 16:53 Comment(3)
cmd + d then disable remote debuggerTribunal
cmd + m just minimises the window. cmd + d is what did it, thanks @TribunalLeucoma
This answer is not relevant. You might wanna update it. cmd + m just minimizes the windowRepresentational
W
23

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

Wilma answered 30/11, 2020 at 8:57 Comment(1)
isn't there any solution with out disabling the debugger? I need to run in debugging mode to see logsYonah
S
12

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.

Schreiner answered 24/1, 2022 at 17:55 Comment(0)
L
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.

Lancers answered 9/7, 2020 at 19:55 Comment(3)
in 2022, with SDK 45, it still working, thanksFlaunch
A ridiculous problem, but at least your solution works, thanksKnapweed
it would be nice if you included how to clear the app data in Expo.Segment
C
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.

Coagulate answered 12/3, 2018 at 14:21 Comment(4)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewOdonto
@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.Coagulate
this worked for me when other solutions did not, thank you.Piassava
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 debuggingRobledo
T
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.

Tractate answered 26/9, 2021 at 22:19 Comment(1)
This should be the accepted answer for MacOS users.Embracery
E
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.

Excited answered 2/5, 2020 at 11:28 Comment(0)
S
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.

Standard answered 3/6, 2020 at 7:6 Comment(0)
T
5

just ctrl+m on the emulator and stop debugging

Thinnish answered 22/9, 2020 at 8:51 Comment(2)
For me that does not work. It does nothing. The debugger is still on.Oxidate
Yes, me too. I can't kill this thing.Trammell
P
3

I had to do:

cd android; gradle uninstallDebug; cd ../; react-native run-android
Pomp answered 22/11, 2018 at 15:3 Comment(0)
P
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.
Premature answered 4/10, 2020 at 5:40 Comment(0)
V
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.

Vantage answered 28/3, 2022 at 8:42 Comment(2)
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.Nalor
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From ReviewArleyne
G
2

clear the expo go application data to solve the problem

Girard answered 12/4, 2022 at 13:22 Comment(0)
M
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.

Mcvay answered 2/5, 2019 at 0:14 Comment(0)
D
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.

Dendrochronology answered 24/7, 2019 at 4:16 Comment(1)
Run the code below, i hope this code work fine : cd android && gradlew clean && cd .. && react-native run-android share editDendrochronology
B
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

Beetlebrowed answered 5/7, 2020 at 11:7 Comment(0)
M
1

Use following steps.

  1. adb kill-server
  2. adb start-server
  3. adb reverse tcp:8081 tcp:8081
Moffitt answered 29/6, 2023 at 6:22 Comment(0)
V
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
Violinist answered 21/7, 2021 at 14:56 Comment(0)
M
0

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

Munoz answered 9/10, 2021 at 7:35 Comment(1)
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From ReviewSisely
A
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.

Accredit answered 26/11, 2022 at 10:1 Comment(0)
V
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
Vierno answered 1/6, 2023 at 11:14 Comment(0)
S
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.

Singsong answered 10/7, 2023 at 18:31 Comment(0)
C
0

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

Calv answered 2/8, 2023 at 10:59 Comment(0)
T
0

Press d on terminal server and your app will show a modal. Select and click in 'Stop Debugging'

Touzle answered 14/10, 2023 at 1:22 Comment(0)
S
-3

Run the code,i hope this code work fine:

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

Sweatt answered 4/3, 2018 at 10:33 Comment(1)
This may need specifying what to run this with. yarn cd android...... etcPelvic

© 2022 - 2025 — McMap. All rights reserved.