diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java index d1f2b994f3d8b0..cbf8de9325376d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java @@ -510,16 +510,19 @@ public void onOptionSelected() { title.setGravity(Gravity.CENTER); title.setTextSize(16); title.setTypeface(title.getTypeface(), Typeface.BOLD); + header.addView(title); - final TextView jsExecutorLabel = new TextView(context); - jsExecutorLabel.setText( - context.getString(R.string.catalyst_dev_menu_sub_header, getJSExecutorDescription())); - jsExecutorLabel.setPadding(0, 20, 0, 0); - jsExecutorLabel.setGravity(Gravity.CENTER); - jsExecutorLabel.setTextSize(14); + String jsExecutorDescription = getJSExecutorDescription(); - header.addView(title); - header.addView(jsExecutorLabel); + if (jsExecutorDescription != null) { + final TextView jsExecutorLabel = new TextView(context); + jsExecutorLabel.setText( + context.getString(R.string.catalyst_dev_menu_sub_header, jsExecutorDescription)); + jsExecutorLabel.setPadding(0, 20, 0, 0); + jsExecutorLabel.setGravity(Gravity.CENTER); + jsExecutorLabel.setTextSize(14); + header.addView(jsExecutorLabel); + } mDevOptionsDialog = new AlertDialog.Builder(context) @@ -539,7 +542,11 @@ public void onOptionSelected() { } private String getJSExecutorDescription() { - return getReactInstanceDevHelper().getJavaScriptExecutorFactory().toString(); + try { + return getReactInstanceDevHelper().getJavaScriptExecutorFactory().toString(); + } catch (IllegalStateException e) { + return null; + } } /**