Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for app restart on Android in case of remote debugging #45772

Closed

Conversation

Sushant-Sardeshpande
Copy link
Contributor

Added a check in setRemoteJSDebugEnabled in DevSupportManagerBase.java to check for PREFS_REMOTE_JS_DEBUG_KEY to see if the value has changed.

Summary:

Fix for #45399 - App restarting when NativeDevSettings.setIsDebuggingRemotely is used in a landing component. If this was invoked from a component load or action that would fire on app start, it was creating an infinite loop where the app would keep on restart before eventually leading to a crash.

Changelog:

Fix issue with NativeDevSettings.setIsDebuggingRemotely where the app would keep on restarting if remote debugging was invoked from an action / component that was called on app start.

Pick one each for the category and type tags:

[ANDROID] [DEPRECATED|FIXED] - Message

Test Plan:

Create a new project using RN CLI. Set newArchEnabled=false.
Install modules using yarn install.
Build from source for Android by setting the following in settings.gradle-
includeBuild('../node_modules/react-native') { dependencySubstitution { substitute(module("com.facebook.react:react-android")).using(project(":packages:react-native:ReactAndroid")) substitute(module("com.facebook.react:react-native")).using(project(":packages:react-native:ReactAndroid")) substitute(module("com.facebook.react:hermes-android")).using(project(":packages:react-native:ReactAndroid:hermes-engine")) substitute(module("com.facebook.react:hermes-engine")).using(project(":packages:react-native:ReactAndroid:hermes-engine")) } }
Set the ANDROID_HOME and ANDROID_NDK_HOME environment variables required for react native.
Call NativeDevSettings.setIsDebuggingRemotely from App.tsx which is the landing component.
Test with both hermesEnabled=true and hermesEnabled=false and ensure that app does not keep on restarting after fix.

Added a check in setRemoteJSDebugEnabled in DevSupportManagerBase.java to check for PREFS_REMOTE_JS_DEBUG_KEY to see if the value has changed.
@facebook-github-bot
Copy link
Contributor

Hi @Sushant-Sardeshpande!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@react-native-bot
Copy link
Collaborator

Fails
🚫

📋 Verify Changelog Format - See Changelog format

Generated by 🚫 dangerJS against e9606af

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants