The SDK is throwing IllegalStateException for some users

android

#1

Hello,

I’m getting an important quantity of crash reports related to an IllegalStateException being thrown by the SDK. This is the full stacktrace:

java.lang.IllegalStateException: Illegal state. at com.mopub.common.Preconditions.checkStateInternal(Preconditions.java:255) at com.mopub.common.Preconditions.checkState(Preconditions.java:52) at com.mopub.mraid.MraidController.getRootView(MraidController.java:841) at com.mopub.mraid.MraidController.access$1200(MraidController.java:54) at com.mopub.mraid.MraidController$7.run(MraidController.java:524) at com.mopub.mraid.MraidController$ScreenMetricsWaiter$WaitRequest.countDown(MraidController.java:385) at com.mopub.mraid.MraidController$ScreenMetricsWaiter$WaitRequest.access$400(MraidController.java:371) at com.mopub.mraid.MraidController$ScreenMetricsWaiter$WaitRequest$1$1.onPreDraw(MraidController.java:407) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2216) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1211) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6282) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788) at android.view.Choreographer.doCallbacks(Choreographer.java:591) at android.view.Choreographer.doFrame(Choreographer.java:560) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5323) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641) at dalvik.system.NativeStart.main(NativeStart.java)

Afaik, I believe this is related to banners and not interstitial and I have no idea why it is happening.

Thank you in advance!


#2

Hey LowlevelStudios,

Apologies for the late reply here. If the issue is still occurring, please see below.

Per the crash report, there seems to be an Illegal state error when checkState(boolean expression) is called in Preconditions.

The illegal state is a result of getRootView.

This leads me to believe that the MRAID ad is being called before the container is ready, throwing the exception and causing the crash.

Could you provide more context as to how this crash is occurring and the setup you have?

  1. What MoPub SDK version are you using?
  2. Can you isolate it to either your banner or interstitial?
  3. What ad unit is this occurring under?
  4. Is this happening with a third party ad source or Marketplace?
  5. Do you know how to reproduce the crash (e.g. just open the app, minimize the app and re-open the app, etc.)? Please provide detail here, so we can reproduce the issue if possible.
  6. Is this happening on our sample app with the same ad unit?

Feel free to answer these questions by emailing support@mopub.com referencing this forum post as there is required information tied to your account (ad unit).

If you have any further questions or need any clarifications in the meantime, please reach out. We would be happy to assist.

Thanks!