Chartboost - crashing when showing video ads.

I updated Corona Enterprise to build 2015.2541 a few days ago in order to build 64 bit iOS apps.

It’s happening on Android + Amazon builds (seems to be ok on iOS), and this is the error message that is shown:

01-29 10:57:56.450: E/AndroidRuntime(6021): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.quiztix.mygame/com.chartboost.sdk.CBImpressionActivity}: java.lang.NullPointerException 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305) 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363) 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.app.ActivityThread.access$900(ActivityThread.java:161) 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265) 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.os.Handler.dispatchMessage(Handler.java:102) 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.os.Looper.loop(Looper.java:157) 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.app.ActivityThread.main(ActivityThread.java:5356) 01-29 10:57:56.450: E/AndroidRuntime(6021): at java.lang.reflect.Method.invokeNative(Native Method) 01-29 10:57:56.450: E/AndroidRuntime(6021): at java.lang.reflect.Method.invoke(Method.java:515) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) 01-29 10:57:56.450: E/AndroidRuntime(6021): at dalvik.system.NativeStart.main(Native Method) 01-29 10:57:56.450: E/AndroidRuntime(6021): Caused by: java.lang.NullPointerException 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.Libraries.j.b(SourceFile:175) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.impl.aj.a(SourceFile:174) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.impl.am.a(SourceFile:63) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.impl.am.\<init\>(SourceFile:42) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.impl.ai$a.\<init\>(SourceFile:83) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.impl.ai$a.\<init\>(SourceFile:69) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.impl.ai.b(SourceFile:539) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.f.c(SourceFile:286) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.Model.a.k(SourceFile:298) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.e.e(SourceFile:75) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.e.a(SourceFile:55) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.Chartboost.a(SourceFile:848) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.c.a(SourceFile:331) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.Chartboost.a(SourceFile:238) 01-29 10:57:56.450: E/AndroidRuntime(6021): at com.chartboost.sdk.CBImpressionActivity.onStart(SourceFile:56) 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1189) 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.app.Activity.performStart(Activity.java:5436) 01-29 10:57:56.450: E/AndroidRuntime(6021): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 01-29 10:57:56.450: E/AndroidRuntime(6021): ... 11 more 01-29 10:57:56.450: W/ActivityManager(3650): Force finishing activity com.quiztix.mygame/com.chartboost.sdk.CBImpressionActivity

I’ve been removing other libs that are not needed in my project anymore, but I don’t think that any of those would be affecting Chartboost.

Is anyone else experiencing the same issue?  

This sounds a bit weird since the Chartboost Android SDK is the same as before, and Android doesn’t do 64-bit builds yet.

I’ll do some experimenting myself and see what I get.

Just curious. Do you only see the crash on Android if you use Corona builds 2541+?

Yes I noticed that the Android builds should be the same, which has me wondering if it could be something in Corona itself that has changed.  

To be honest, I’m a bit reluctant to get a newer build because we have a submission deadline today. Builds after 2541 have moved local and push notifications into a plugin, and that’s just more time needed for implementation and testing which we can’t spare.

Do you get a crash every time you try to show video ads or is it intermittent?

Every single time without fail - or rather with fail :slight_smile:  

Happens on both GP and Amazon builds. The only other thing I can think would be that I had to subclass the Corona Activity itself in order for 2 plugin we use to work (they would only work when included in the main activity itself).

\<activity android:name="com.ansca.corona.QuizTixCoronaActivity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|screenSize|orientation" android:label="@string/app\_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"\> \<meta-data android:name="supportsOrientationPortrait" android:value="true" /\> \<meta-data android:name="supportsOrientationPortraitUpsideDown" android:value="true" /\> \<meta-data android:name="supportsOrientationLandscapeRight" android:value="true" /\> \<meta-data android:name="supportsOrientationLandscapeLeft" android:value="true" /\> \<intent-filter\> \<action android:name="android.intent.action.MAIN" /\> \<category android:name="android.intent.category.LAUNCHER" /\> \</intent-filter\> \</activity\> \<activity android:name="com.ansca.corona.CoronaActivity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|screenSize|orientation" android:label="@string/app\_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"\> \<meta-data android:name="supportsOrientationPortrait" android:value="true" /\> \<meta-data android:name="supportsOrientationPortraitUpsideDown" android:value="true" /\> \<meta-data android:name="supportsOrientationLandscapeRight" android:value="true" /\> \<meta-data android:name="supportsOrientationLandscapeLeft" android:value="true" /\> \</activity\>

I did this a month or so ago, and I’m sure it was working since that point - but is it possible that the activity is causing the problem? I’ve tried with android:launchMode=“singleTask” on and off, and that had no effect (again we’ve had to remove it for one of our other ad libs to work).

I’m not sure, but that might be one reason for it to fail.

I’ll be experimenting with this later later today and I’ll report back my results.

I’ve done some testing however Chartboost doesn’t serve any video ads to my app for Android. Fullscreen Interstitials work fine though.

For iOS it serves at least a few before depleting its inventory (and videos on iOS works AFAICT).

There seems to be no inventory for video ads here in Korea for Android, so I can’t do much more testing at the moment.

If anything, I suspect that subclassing the activity might have thrown Chartboost for a loop. One thing that you might be able to test, if you have the time, is to temporarily remove your subclass and see if the video ads work. 

… and just FYI the last Android Chartboost plugin update was made Dec 10, 2014. 

@Alan

I was able to get a rewarded video to display properly today on Android without any errors or crashes.

I’m suspecting that the subclassing might be the culprit here as the code relies on the function CoronaEnvironment.getCoronaActivity() to return the active Corona activity that’s later passed on to Chartboost. It would seem like this function doesn’t return a pointer to your custom activity.

Not sure what’s going on then, I’ve just tried making another build using the default CoronaActivity and I still get the same error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.quiztix.mygame/com.chartboost.sdk.CBImpressionActivity}: java.lang.NullPointerException

The “willDisplay” call comes back before hand, and then this every time:

02-16 12:17:13.912: W/dalvikvm(18197): threadid=1: thread exiting with uncaught exception (group=0x41d5fd58) 02-16 12:17:13.912: W/System.err(18197): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mygame.gamename/com.chartboost.sdk.CBImpressionActivity}: java.lang.NullPointerException 02-16 12:17:13.912: W/System.err(18197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2260) 02-16 12:17:13.912: W/System.err(18197): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2325) 02-16 12:17:13.912: W/System.err(18197): at android.app.ActivityThread.access$800(ActivityThread.java:145) 02-16 12:17:13.912: W/System.err(18197): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1216) 02-16 12:17:13.912: W/System.err(18197): at android.os.Handler.dispatchMessage(Handler.java:102) 02-16 12:17:13.912: W/System.err(18197): at android.os.Looper.loop(Looper.java:145) 02-16 12:17:13.912: W/System.err(18197): at android.app.ActivityThread.main(ActivityThread.java:5266) 02-16 12:17:13.912: W/System.err(18197): at java.lang.reflect.Method.invokeNative(Native Method) 02-16 12:17:13.912: W/System.err(18197): at java.lang.reflect.Method.invoke(Method.java:515) 02-16 12:17:13.912: W/System.err(18197): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826) 02-16 12:17:13.912: W/System.err(18197): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642) 02-16 12:17:13.912: W/System.err(18197): at dalvik.system.NativeStart.main(Native Method) 02-16 12:17:13.912: W/System.err(18197): Caused by: java.lang.NullPointerException 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.Libraries.j.b(SourceFile:175) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.impl.aj.a(SourceFile:174) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.impl.am.a(SourceFile:63) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.impl.am.\<init\>(SourceFile:42) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.impl.ai$a.\<init\>(SourceFile:83) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.impl.ai$a.\<init\>(SourceFile:69) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.impl.ai.b(SourceFile:539) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.f.c(SourceFile:286) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.Model.a.k(SourceFile:298) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.e.e(SourceFile:75) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.e.a(SourceFile:55) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.Chartboost.a(SourceFile:848) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.c.a(SourceFile:331) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.Chartboost.a(SourceFile:238) 02-16 12:17:13.912: W/System.err(18197): at com.chartboost.sdk.CBImpressionActivity.onStart(SourceFile:56) 02-16 12:17:13.912: W/System.err(18197): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171) 02-16 12:17:13.912: W/System.err(18197): at android.app.Activity.performStart(Activity.java:5287) 02-16 12:17:13.912: W/System.err(18197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2229) 02-16 12:17:13.912: W/System.err(18197): ... 11 more 02-16 12:17:13.912: W/AsyncHttpResponseHandler(18197): Current thread has not called Looper.prepare(). Forcing synchronous mode. 02-16 12:17:13.932: I/Corona(18197): event.type = applicationSuspend 02-16 12:17:13.932: I/ActivityManager(910): handleApplicationCrash 02-16 12:17:13.932: E/AndroidRuntime(18197): FATAL EXCEPTION: main 02-16 12:17:13.932: E/AndroidRuntime(18197): Process: com.mygame.gamename, PID: 18197 02-16 12:17:13.932: E/AndroidRuntime(18197): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mygame.gamename/com.chartboost.sdk.CBImpressionActivity}: java.lang.NullPointerException 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2260) 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2325) 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.app.ActivityThread.access$800(ActivityThread.java:145) 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1216) 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.os.Handler.dispatchMessage(Handler.java:102) 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.os.Looper.loop(Looper.java:145) 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.app.ActivityThread.main(ActivityThread.java:5266) 02-16 12:17:13.932: E/AndroidRuntime(18197): at java.lang.reflect.Method.invokeNative(Native Method) 02-16 12:17:13.932: E/AndroidRuntime(18197): at java.lang.reflect.Method.invoke(Method.java:515) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642) 02-16 12:17:13.932: E/AndroidRuntime(18197): at dalvik.system.NativeStart.main(Native Method) 02-16 12:17:13.932: E/AndroidRuntime(18197): Caused by: java.lang.NullPointerException 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.Libraries.j.b(SourceFile:175) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.impl.aj.a(SourceFile:174) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.impl.am.a(SourceFile:63) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.impl.am.\<init\>(SourceFile:42) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.impl.ai$a.\<init\>(SourceFile:83) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.impl.ai$a.\<init\>(SourceFile:69) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.impl.ai.b(SourceFile:539) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.f.c(SourceFile:286) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.Model.a.k(SourceFile:298) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.e.e(SourceFile:75) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.e.a(SourceFile:55) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.Chartboost.a(SourceFile:848) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.c.a(SourceFile:331) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.Chartboost.a(SourceFile:238) 02-16 12:17:13.932: E/AndroidRuntime(18197): at com.chartboost.sdk.CBImpressionActivity.onStart(SourceFile:56) 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171) 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.app.Activity.performStart(Activity.java:5287) 02-16 12:17:13.932: E/AndroidRuntime(18197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2229) 02-16 12:17:13.932: E/AndroidRuntime(18197): ... 11 more 02-16 12:17:13.932: I/AndroidRuntime(18197): To Report FATAL to activityManagerService

That sounds very weird. 

What version of the plugin is being used? ( chartboost.getPluginVersion() )

02-16 12:57:01.512: I/Corona(25931): Chartboost Plugin version Android SDK 5.1.0 rev 1

I’ve just made a test app which does nothing but have a single button which calls Chartboost video, and that’s crashing too. Just testing out one other thing, if that doesn’t work can I email you the test project so you can see if anything is amiss? 

My test pointed to the cause of the issue - it’s only failing when certain ID/signatures are used.

So most likely this is a Chartboost server issue and nothing to do with the plugin.

OK. It may be a good idea to shoot a message to (support at chartboost dot com), and include one of your ID’s you’re having trouble with (Sig’s are not necessary). They usually respond to support emails within 24 hours.

Just had the client screenshare their Chartboost console with me, and the video campaigns had not been setup so I’m just giving it an hour or so for that to propagate through their systems.

I would say “stupid me”, but they had screen shared with me before and I saw them being set up. I know that when they did this, they clicked the button to view the old style dashboard, so perhaps that caused an issue somewhere along the line and the campaigns did not save. So if anyone else has similar issues, double check the dashboard  :slight_smile:

Thanks for your help as always ingemar.

No problem. Glad that you were able solve it!  :slight_smile:

I’ll contact Chartboost and ask them if it’s possible to add some failsafe to handle this issue more gracefully with an error message instead of a crash.

@Alan

Have your issues with crashing apps on Android been fully resolved?

The guys at Chartboost were wondering if this issue can be closed.

As it turned out, the error was still present. I got in touch with chartboost who told me it was because we had post roll confirmation turned off.
Not sure if you remember but that was an issue that I’d mentioned to you a while back, and you had reported to them. Not sure how it came back, as it only affected the new project, the old one still worked without a post roll confirmation.
Added the confirmation which fixed the crash, and they’ve just emailed me to say they’ve fixed their server side now so the error should be gone completely, but I still need to test that.

…added the confirmation which fixed the crash, and they’ve just emailed me to say they’ve fixed their server side now so the error should be gone completely, but I still need to test that…

I vaguely remember. Hopefully this issue is finally fixed then.

Tell me if you still have issues after testing and I’ll contact Chartboost again.

Hi again ingemar, I’m afraid Chartboost video crashes have somehow returned.

It doesn’t happen every time, but it definitely is Chartboost that’s causing the crash as removing the calls to show chartboost ads fixes it.

There are no real error message in the console, for the previous error there were distinct java runtime errors. Now we just get the app hanging for a few seconds, and then the log shows that the app is unresponsive so is being terminated.

Have you seen anything similar happening?

Edit: I see there have been a few video fixes for the Chartboost SDK itself (v5.1.3 - Mar. 17, 2015), and the plugin is currently using 5.1.0 I believe, so possibly updating the plugin will fix this.