-
Couldn't load subscription status.
- Fork 113
Open
Description
I am unable to get a mini app running inside an external android project, and consistently get this error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.rosettastone.testapp, PID: 29470
java.lang.ClassCastException: com.walmartlabs.ern.container.miniapps.TestMiniAppActivity cannot be cast to androidx.fragment.app.FragmentActivity
at com.facebook.react.modules.dialog.DialogModule.getFragmentManagerHelper(DialogModule.java:245)
at com.facebook.react.modules.dialog.DialogModule.onHostResume(DialogModule.java:177)
at com.facebook.react.bridge.ReactContext$1.run(ReactContext.java:174)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
To reproduce:
- Start a new ern mini app
ern create-miniapp test - Create a new android project in android studio, selecting "Basic Activity" and the defaults from there on.
- Run ern run-android, verify the application correctly launches
- Run the android project from android studio, verify it launches
- Publish the mini app
ern publish-container --platform android -p ern-container-publisher-maven -e publish.json - Integrate the mini app into the android app (see https://github.com/marc-hughes/electrode-native-fragment-bug-report for full code)
- Run the android app, get the error above.
The cause appears to be that react native's DialogModule attempts to do this:
private @Nullable FragmentManagerHelper getFragmentManagerHelper() {
Activity activity = getCurrentActivity();
if (activity == null) {
return null;
}
return new FragmentManagerHelper(((FragmentActivity) activity).getSupportFragmentManager());
}
And the mini app does not inherit from FragmentActivity.
It looks like this would have been an issue since facebook/react-native#23365
ern --version
___ _ _ _ _ _ _ _
| __| |___ __| |_ _ _ ___ __| |___ | \| |__ _| |_(_)_ _____
| _|| / -_) _| _| '_/ _ \/ _` / -_) | .` / _` | _| \ V / -_)
|___|_\___\__|\__|_| \___/\__,_\___| |_|\_\__,_|\__|_|\_/\___|
[v0.38.2] [Cauldron: tutoring-cauldron]
ℹ ern-local-cli : 0.38.2
ℹ electrode-native : 1.0.17
friederbluemle, woshi82, felipeduarte-walmartlabs and stevdza-san
Metadata
Metadata
Assignees
Labels
No labels