1

In my ejected React Native app for android, I'm getting this run time error out of the blue

java.lang.NoClassDefFoundError: android.support.v4.app.FragmentActivity
                  at com.facebook.react.modules.dialog.DialogModule.getFragmentManagerHelper(DialogModule.java:271)
                  at com.facebook.react.modules.dialog.DialogModule.onHostResume(DialogModule.java:209)
                  at com.facebook.react.bridge.ReactContext$1.run(ReactContext.java:150)
                  at android.os.Handler.handleCallback(Handler.java:822)
                  at android.os.Handler.dispatchMessage(Handler.java:104)
                  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                  at android.os.Looper.loop(Looper.java:207)
                  at android.app.ActivityThread.main(ActivityThread.java:5811)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)

What might be the reason for this error?

palerdot
  • 7,416
  • 5
  • 41
  • 47

1 Answers1

0

I have been struggling this issue for over a week now, and It got solved by adding this specific dependency in my app gradle file

compile 'com.android.support:support-v4:26.1.0'

I got the cue from this weird facebook sdk issue posted here - https://github.com/facebook/facebook-sdk-for-unity/issues/109. After adding this dependency I was able to overcome the NoClassDefFoundError.

I almost scoured the whole internet for a week and I was not able to make any headway for this issue. Just answering my own question for future reference.

palerdot
  • 7,416
  • 5
  • 41
  • 47
  • I think for more optimize solution you must this solution . [react-native-fbsdk](https://stackoverflow.com/questions/47757074/react-native-fbsdk-error-no-resource-found-that-matches-the-given-name-attr-a/47786292#47786292) – Syed Zain Ali Jan 07 '18 at 08:46