Chartboost - IllegalArgumentException when loading a video

You mention Android 6 specifically.

Does this only happen on Android 6?

I tested also on Android 4.3.1 and 4.1.2 and it hasn’t happened there at all, but I haven’t tested on Android 5. 

On Android 6 it happens all the time (on several devices). 

You also mention “every other session”.

Does that mean the first time the app runs, it’s OK, but the second time you start the app, it fails?

I tried several times on Android 4, and 5 but couldn’t reproduce.

However I did manage to reproduce it on Android 7 after a few attempts. 

I’ll investigate.

Any progress with this?

I’ve just experienced a slightly different crash, although it looks like from the same source (maybe it will help with the debugging). 

10-15 11:55:47.839 11208 11208 W System.err: java.lang.IllegalArgumentException: illegal index 10-15 11:55:47.839 11208 11208 W System.err:    at com.naef.jnlua.LuaState.lua\_setfield(Native Method) 10-15 11:55:47.839 11208 11208 W System.err:    at com.naef.jnlua.LuaState.setField(Unknown Source) 10-15 11:55:47.839 11208 11208 W System.err:    at plugin.chartboost.LuaLoader$3.run(LuaLoader.java:348) 10-15 11:55:47.839 11208 11208 W System.err:    at android.app.Activity.runOnUiThread(Activity.java:6035) 10-15 11:55:47.839 11208 11208 W System.err:    at plugin.chartboost.LuaLoader.dispatchLuaEvent(LuaLoader.java:373) 10-15 11:55:47.839 11208 11208 W System.err:    at plugin.chartboost.LuaLoader.access$1400(LuaLoader.java:49) 10-15 11:55:47.839 11208 11208 W System.err:    at plugin.chartboost.LuaLoader$CoronaChartboostDelegate.didInitialize(LuaLoader.java:1202) 10-15 11:55:47.839 11208 11208 W System.err:    at com.chartboost.sdk.c$1.a(SourceFile:397) 10-15 11:55:47.839 11208 11208 W System.err:    at com.chartboost.sdk.impl.ae$e$a.a(SourceFile:291) 10-15 11:55:47.839 11208 11208 W System.err:    at com.chartboost.sdk.impl.ae$e$a.a(SourceFile:199) 10-15 11:55:47.839 11208 11208 W System.err:    at com.chartboost.sdk.impl.ak$a.run(SourceFile:219) 10-15 11:55:47.839 11208 11208 W System.err:    at android.os.Handler.handleCallback(Handler.java:739) 10-15 11:55:47.839 11208 11208 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:95) 10-15 11:55:47.839 11208 11208 W System.err:    at android.os.Looper.loop(Looper.java:158) 10-15 11:55:47.839 11208 11208 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:7224) 10-15 11:55:47.839 11208 11208 W System.err:    at java.lang.reflect.Method.invoke(Native Method) 10-15 11:55:47.839 11208 11208 W System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 10-15 11:55:47.839 11208 11208 W System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

@stanga

Thanks for the crash report. It helped me isolate the problem. It also looks like the second crash was happening for the same reason.

I’ve fixed the issue and it’s live on the build server.

I can verify the crash is resolved. 

Thank you!

There is another issue I am facing now.

On my Galaxy S2 with Android 4.3.1, I can’t view videos anymore. 

After calling show(), I get a black screen and the following stack trace appears in the logs: 

W/System.err( 5682): java.lang.SecurityException: Neither user 10073 nor current process has android.permission.READ\_PHONE\_STATE. W/System.err( 5682):    at android.os.Parcel.readException(Parcel.java:1431) W/System.err( 5682):    at android.os.Parcel.readException(Parcel.java:1385) W/System.err( 5682):    at com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy.listen(ITelephonyRegistry.java:233) W/System.err( 5682):    at android.telephony.TelephonyManager.listen(TelephonyManager.java:1299) W/System.err( 5682):    at com.chartboost.sdk.CBImpressionActivity.onStart(SourceFile:89) W/System.err( 5682):    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171) W/System.err( 5682):    at android.app.Activity.performStart(Activity.java:5143) W/System.err( 5682):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302) W/System.err( 5682):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389) W/System.err( 5682):    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3868) W/System.err( 5682):    at android.app.ActivityThread.access$700(ActivityThread.java:153) W/System.err( 5682):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1275) W/System.err( 5682):    at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err( 5682):    at android.os.Looper.loop(Looper.java:137) W/System.err( 5682):    at android.app.ActivityThread.main(ActivityThread.java:5289) W/System.err( 5682):    at java.lang.reflect.Method.invokeNative(Native Method) W/System.err( 5682):    at java.lang.reflect.Method.invoke(Method.java:525) W/System.err( 5682):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) W/System.err( 5682):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) W/System.err( 5682):    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126) W/System.err( 5682):    at dalvik.system.NativeStart.main(Native Method)

The screen stays black until I move the app to the background. 

When the app returns to the foreground, the black screen is gone, but it looks like the plugin still believes an ad is showing. 

chartboost.isAdVisible() returns true and when I call show() again, I get the following callback:

{    phase = "failed",    type = "rewardedVideo",    isError = false,    response = "loadFailed",    data=  {"errorCode":8,"location":"Default","errorMsg":"IMPRESSION\_ALREADY\_VISIBLE"} }

So basically, there are several issues here:

– We are not asking for the permission READ_PHONE_STATE, so we shouldn’t get the SecurityException.

– Videos should be able to show on this device and OS (it has worked up until today).

– When loosing focus and returning to the app, it didn’t manage to close the ad, although it was not visible. 

Can you help us with these issues as well?

Thanks

This looks like an issue within the Chartboost SDK. All I can do is report it to Chartboost.

In this particular case Chartboost is *requiring* READ_PHONE_STATE. So that might be the whole reason for the black screen issue as the ad cannot be shown because of the lack of this permission.

In this kind of situation, when isAdVisible() returns true, you can call hide() to force close the ad to continue serving other ads in your app.

Since it worked up until today, I’m suspecting they have changed something on their back-end recently that is causing this issue.

I’ll report the issue to Chartboost. However it’s the weekend, so it may take some time for them to reply.

According to the plugin docs, the READ_PHONE_STATE permission is optional:

https://docs.coronalabs.com/plugin/chartboost/index.html

Also, this exception is present only in old android os’s (4.3.1). On Android 6 I don’t see it.  

Thanks for forwarding this to Chartboost, I’ll wait patiently for an answer :slight_smile:

Yes, according to Chartboost READ_PHONE_STATE is optional.

I’ve testing on my devices 2.3.6, 4.0.4, 5.1.1 and 7.0 and videos show as expected.

Since it worked until today, I’m suspecting somebody at Chartboost made a “booboo” updating their system which affects certain devices.

@stanga

Do you still see the READ_PHONE_STATE issue?

I still get a black screen on old android os’s when trying to show videos, and I see the READ_PHONE_STATE stack in the logs. 

I’m not sure the 2 are related though, because I’m able to see interstitials, and when I do I see the READ_PHONE_STATE stack in the logs as well. 

What could be the cause of the black screen?

I can’t reproduce the issue myself. I’ve tested on Android 2.3.6 and 4.0.4. However I got a reply back from Chartboost asking if you could give them an APK for testing. If you are willing to do so, you can PM me and attach the APK, and I’ll forward it to them.

any news? 

We manage to reproduce the black screen with a few android 4.X device. 

Also, we see crashes on an android 5.1.1 device when trying to show an interstitial:

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.chartboost.sdk.impl.bh.loadUrl(java.lang.String)' on a null object reference     at com.chartboost.sdk.impl.bi$1.run(SourceFile:251)     at android.os.Handler.handleCallback(Handler.java:739)     at android.os.Handler.dispatchMessage(Handler.java:95)     at android.os.Looper.loop(Looper.java:135)     at android.app.ActivityThread.main(ActivityThread.java:5294)     at java.lang.reflect.Method.invoke(Native Method)     at java.lang.reflect.Method.invoke(Method.java:372)     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

@stanga

No news about the second issue you reported on this thread. It’s been reported to Chartboost and I’ve given them the APK you sent to me.

From the crash log of the third issue you are reporting, I can see that it’s a problem within the Chartboost SDK. I will open up a new ticket with Chartboost regarding this matter.

This particular thread now has 3 different issues. Going forward, since the original issue for this thread has been solved, it would be better to report new issues in their own posts as the title of this thread doesn’t match the other 2 issues. It can easily become confusing as to what is being discussed if new issues keep being reported on the same thread.

@stanga

Can you check if Issue 2 in this thread (READ_PHONE_STATE crash) still occurs? I got feedback from Chartboost suggesting a modification to the Android manifest which is now live.

Issue 3 (NullPointerException: Attempt to invoke virtual method) is similar to another issue that they are looking into. They will get back to me.

@stanga

I got confirmation that issue 3 will be fixed in their next SDK release.

@ingemar_cl

Has issue 3 been fixed?

I’m getting java.lang.NullPointerException: Attempt to invoke virtual method ‘int com.chartboost.sdk.Libraries.i$a.e()’ on a null object reference on some of the devices

java.lang.NullPointerException: Attempt to invoke virtual method 'int com.chartboost.sdk.Libraries.i$a.e()' on a null object reference at com.chartboost.sdk.Libraries.i.b(SourceFile:182) at com.chartboost.sdk.impl.k.a(SourceFile:272) at com.chartboost.sdk.impl.o.\<init\>(SourceFile:86) at com.chartboost.sdk.impl.l$a.\<init\>(SourceFile:99) at com.chartboost.sdk.impl.l$a.\<init\>(SourceFile:77) at com.chartboost.sdk.impl.l.b(SourceFile:621) at com.chartboost.sdk.f.c(SourceFile:296) at com.chartboost.sdk.Model.a.k(SourceFile:389) at com.chartboost.sdk.e.e(SourceFile:89) at com.chartboost.sdk.e.a(SourceFile:68) at com.chartboost.sdk.h.a(SourceFile:590) at com.chartboost.sdk.c.a(SourceFile:341) at com.chartboost.sdk.h.d(SourceFile:255) at com.chartboost.sdk.CBImpressionActivity.onStart(SourceFile:86) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1266) at android.app.Activity.performStart(Activity.java:6943) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3276) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) at android.app.ActivityThread.access$1100(ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7331) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

@asad

That’s another issue that’s hasn’t been reported before. However since it’s not directly related to the plugin I think it’s best for you to send an email with your findings to support@chartboost.com. You can also mention that Chartboost Android SDK version 6.5.1 is being used.