android.app.Application cannot be cast to com.facebook.react.ReactApplication
See original GitHub issueAfter install the UIExplorer Example via adb install /xxx/.../app-debug.apk
, but failed to lauch it.
adb logcat
, give me the following error logs.
E/AndroidRuntime(32698): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.facebook.react.uiapp/com.facebook.react.uiapp.UIExplorerActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.facebook.react.ReactApplication
E/AndroidRuntime(32698): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2341)
E/AndroidRuntime(32698): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2403)
E/AndroidRuntime(32698): at android.app.ActivityThread.access$800(ActivityThread.java:154)
E/AndroidRuntime(32698): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
E/AndroidRuntime(32698): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(32698): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(32698): at android.app.ActivityThread.main(ActivityThread.java:5298)
E/AndroidRuntime(32698): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(32698): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(32698): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:910)
E/AndroidRuntime(32698): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:705)
E/AndroidRuntime(32698): Caused by: java.lang.ClassCastException: android.app.Application cannot be cast to com.facebook.react.ReactApplication
E/AndroidRuntime(32698): at com.facebook.react.ReactActivity.getReactNativeHost(ReactActivity.java:79)
E/AndroidRuntime(32698): at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:107)
E/AndroidRuntime(32698): at com.facebook.react.uiapp.UIExplorerActivity.onCreate(UIExplorerActivity.java:44)
E/AndroidRuntime(32698): at android.app.Activity.performCreate(Activity.java:6049)
E/AndroidRuntime(32698): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
E/AndroidRuntime(32698): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2294)
E/AndroidRuntime(32698): ... 10 more
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
android.app.Application cannot be cast to com.facebook.react ...
react-native upgrade. And I'm getting the error when I try to build the app: android.app.Application cannot be cast to com.facebook.react.ReactApplication.
Read more >Fix Application crash Error “android.app.Application cannot be ...
FATAL EXCEPTION, Fix Application crash Error “ android. app. Application cannot be cast to”#FataException #RuntimeException #JavaException.
Read more >Android app application cannot be cast to com facebook react ...
Inconvertible types cannot cast android app activity ... You should import the fragment class "android.app.Fragment" and not the "android.support.v4.app.Fragment" ...
Read more >android.app.Application cannot be cast to com.facebook.react ...
Adding the following to AndroidManifest.xml should solve the error: <application android:name=".MainApplication"
Read more >Integration with an Android Fragment - React Native
The guide for Integration with Existing Apps details how to ... need to implement the ReactApplication interface in your main Application ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pauliusuza Adding the following to
AndroidManifest.xml
seems to have fixed for me - or at least changed the error that I am getting - trying to solve that now.Just ran into this myself while upgrading
0.28.0
->0.29.2
.Running
react-native upgrade
made all of the appropriate changes automatically _EXCEPT_ the change mentioned above.For posterity: