“Unfortunately, app has stopped” error with buildi

2020-08-24 08:16发布

问题:

I'm trying to run a project written in React Native and the app crashes:

The solution stated on this thread is irrelevant since the enableProguardInReleaseBuilds variable is already configured to false.

I've also had problems with RCT Video, solved with this thread so maybe it's related.

Thanks in advance.

回答1:

Solved after debugging in Android Studio.

The error I had (java.lang.ClassCastException: android.app.Application cannot be cast to com.facebook.react.ReactApplication) was solved with greena13's answer on this thread.



回答2:

When you encounter Unfortunately, app has stopped error and your app was crashed. You just need to debugging with android studio with following steps:

  1. Open command prompt in root of the you react native app directory and run react-native start
  2. Open your android studio software and click on (Shift + F10) button
  3. And finally click on logcat button (in the bottom left) and see the reason for its crash



回答3:

This can also happen if you remove a class from your project but still refer to it within AndroidManifest.xml. Check your AndroidManifest.xml for any references to old libraries you have stripped out from your project.