android crashes

@ingemar

I am sorry to report that the error has not been fully resolved even with adding the proper code on applicationResume.

This is an excerpt from the log…

E/Sensors (  761): requested_sensors(70) from kernel

D/KeyguardUpdateMonitor( 9257): sendKeyguardVisibilityChanged(true)

D/KeyguardUpdateMonitor( 9257): handleKeyguardVisibilityChanged(1)

D/KeyguardUpdateMonitor( 9257): sendKeyguardVisibilityChanged(true)

D/KeyguardUpdateMonitor( 9257): handleKeyguardVisibilityChanged(1)

D/PhoneStatusBar( 9257): setTransGradationMode=false, mTransparentMode=false, mSemiTransparentMode=false, mMultiWindowMode=false

D/StatusBarManagerService(  761): tr p:31166,o:f

D/AndroidRuntime(31166): Shutting down VM

W/dalvikvm(31166): threadid=1: thread exiting with uncaught exception (group=0x41716da0)

E/AndroidRuntime(31166): FATAL EXCEPTION: main

E/AndroidRuntime(31166): Process: com.gmail.popalzie.TinyCanoeV2, PID: 31166

E/AndroidRuntime(31166): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gmail.popalzie.TinyCanoeV2/com.chartboost.sdk.CBImpressionActivity}: java.lang.NullPointerException: uriString

E/AndroidRuntime(31166): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)

E/AndroidRuntime(31166): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)

E/AndroidRuntime(31166): at android.app.ActivityThread.access$900(ActivityThread.java:169)

E/AndroidRuntime(31166): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)

E/AndroidRuntime(31166): at android.os.Handler.dispatchMessage(Handler.java:102)

E/AndroidRuntime(31166): at android.os.Looper.loop(Looper.java:146)

E/AndroidRuntime(31166): at android.app.ActivityThread.main(ActivityThread.java:5487)

E/AndroidRuntime(31166): at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(31166): at java.lang.reflect.Method.invoke(Method.java:515)

E/AndroidRuntime(31166): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)

E/AndroidRuntime(31166): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)

E/AndroidRuntime(31166): at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime(31166): Caused by: java.lang.NullPointerException: uriString

E/AndroidRuntime(31166): at android.net.Uri$StringUri.<init>(Uri.java:467)

E/AndroidRuntime(31166): at android.net.Uri$StringUri.<init>(Uri.java:457)

E/AndroidRuntime(31166): at android.net.Uri.parse(Uri.java:429)

E/AndroidRuntime(31166): at com.chartboost.sdk.impl.ao.a(SourceFile:381)

E/AndroidRuntime(31166): at com.chartboost.sdk.impl.ai$a.<init>(SourceFile:177)

E/AndroidRuntime(31166): at com.chartboost.sdk.impl.ai$a.<init>(SourceFile:73)

E/AndroidRuntime(31166): at com.chartboost.sdk.impl.ai.b(SourceFile:546)

E/AndroidRuntime(31166): at com.chartboost.sdk.f.c(SourceFile:286)

E/AndroidRuntime(31166): at com.chartboost.sdk.Model.a.k(SourceFile:299)

E/AndroidRuntime(31166): at com.chartboost.sdk.e.e(SourceFile:75)

E/AndroidRuntime(31166): at com.chartboost.sdk.e.a(SourceFile:55)

E/AndroidRuntime(31166): at com.chartboost.sdk.Chartboost.a(SourceFile:920)

E/AndroidRuntime(31166): at com.chartboost.sdk.c.a(SourceFile:336)

E/AndroidRuntime(31166): at com.chartboost.sdk.Chartboost.a(SourceFile:255)

E/AndroidRuntime(31166): at com.chartboost.sdk.CBImpressionActivity.onStart(SourceFile:56)

E/AndroidRuntime(31166): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1177)

E/AndroidRuntime(31166): at android.app.Activity.performStart(Activity.java:5461)

E/AndroidRuntime(31166): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)

E/AndroidRuntime(31166): … 11 more

I/SpenGestureManager(  761): setFocusWindow21030

D/PointerIcon(  761): setMouseIconStyle1 pointerType: 1001iconType:101 flag:0

D/PointerIcon(  761): setMouseCustomIcon IconType is same.101

W/ActivityManager(  761):   Force finishing activity com.gmail.popalzie.TinyCanoeV2/com.chartboost.sdk.CBImpressionActivity

W/ActivityManager(  761):   Force finishing activity com.gmail.popalzie.TinyCanoeV2/com.ansca.corona.CoronaActivity

I/dumpstate(31288): begin

I/dalvikvm-heap(  761): Grow heap (frag case) to 50.128MB for 1127536-byte allocation

I/ServiceKeeper(  761): In getseinfo pid = 761 uid = 1000 seinfo= system

I/ServiceKeeper(  761): In getseinfo pid = 761 uid = 1000 seinfo= system

V/AudioPolicyManagerBase(  183): stopOutput() output 2, stream 3, session 11723

It is definitely not occurring as much without the other code but it is still happening and I am confident that it doesn’t have to do with the resuming anything. I have attached the entire log to the thread.  I have been testing this on Android today and it has crashed multiple times and it seems to only be triggered with me clicking on any button that will load an ad.  

An example of my code for displaying the ad is as follows:

function showInterstitialAd() if not chartboost.hasCachedInterstitial() then chartboost.cache( "interstitial" ) storyboard.gotoScene( "start" ) else chartboost.show( "interstitial" ) end end function scene:enterScene(event) --cache the interstitial ad chartboost.cache( "interstitial") storyboard.removeScene("game") Runtime:addEventListener( "key", onBackButtonPressed ); saveScore() timer.performWithDelay(500,showGameOver,1) timer.performWithDelay(500,loadScore, 1) end

I don’t know what I am doing wrong.  If I can’t get some stability though, I will have to go back to Admob which is not something I want to do.

Sorry, the log file didn’t get uploaded.  It should be attached now.

I’ve had a look at your logs and I can’t find anything unusual. For me Chartboost is stable on Android and I can’t reproduce your issues and I can’t force my apps to crash at all. I’m only using static interstitials myself though.

Video ads have known to be problematic on Android in the past, but they have recently made several improvements to their Android SDK for video ads.

The weird thing is that your errors all seem to indicate that the initialization somehow gets “forgotten”. I can’t understand why.

I’m just grasping at straws here, but on a coding note I never change scenes while chartboost is working. That means I never call chartboost.cache() and then change scenes, or show an ad and change scenes before the ad is closed. All my Chartboost activity pertaining to the scene is done within the scene itself. I don’t think it should matter, but that’s one thing I see is different in my coding practice. Another difference is that I use the Composer API, not the old Storyboard API.

I wish I could help further, but as I’m not able to reproduce the crashes it’s difficult to know what may be wrong.

A new version of the Chartboost Android plugin has been released (Android SDK 5.2.0 rev 1).

Chartboost have fixed many crashing issues on the Android platform, and hopefully your crashing issues have also been fixed.

I’ve seen this kind of error before if you are showing video ads, and if you have turned off “Show Post roll confirmation” in the “Rewarded Videos” settings for the app in the Chartboost dashboard. The only way to fix it is to leave “Show Post roll confirmation” on at the moment. Chartboost have some fixes on the way, but I don’t think they are implemented yet.

This only happens on Android.

Can you reproduce this crash yourself?

Thanks for getting back to me.  Unless the chartboost guys changed the setting in my admin (I had previously contacted them without realizing the plugin wasn’t theirs) the setting was already enabled (both pre and post roll checkboxes were checked).  I was going to try to see if I could reproduce the issue myself.  We got quite a few of the exceptions from players over the last several days.

It’s a bit tricky to track down unless the crash can be reproduced. The issue I mentioned above was crashing consistently, so it was possible to isolate.

BTW:

Are these crash reports something that all of a sudden have started to drop in?

In other words, did your app work fine until recently, and you noticed these reports started to come in now?

They were happening within a narrow time frame.  There is a new crash report that started happening today after we re-enabled chartboost.  It seems to be happening when the app is exiting?

java.lang.RuntimeException: Unable to destroy activity {com.playzot.grabbyWord/com.ansca.corona.CoronaActivity}: java.lang.IllegalStateException: Need to intialize chartboost using Chartboost.init() as the application object is null
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3851)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3869)
at android.app.ActivityThread.access$1500(ActivityThread.java:170)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1357)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5635)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: Need to intialize chartboost using Chartboost.init() as the application object is null
at com.chartboost.sdk.b.p(SourceFile:370)
at com.chartboost.sdk.Chartboost.onStop(SourceFile:353)
at plugin.chartboost.LuaLoader$3.run(LuaLoader.java:243)
at android.app.Activity.runOnUiThread(Activity.java:5045)
at plugin.chartboost.LuaLoader.onExiting(LuaLoader.java:250)
at com.ansca.corona.CoronaEnvironment$RuntimeEventHandler.onExiting(CoronaEnvironment.java:470)
at com.ansca.corona.CoronaRuntime.onExiting(CoronaRuntime.java:422)
at com.ansca.corona.CoronaRuntime.dispose(CoronaRuntime.java:76)
at com.ansca.corona.CoronaActivity.onDestroy(CoronaActivity.java:694)
at android.app.Activity.performDestroy(Activity.java:5757)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1123)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3833)
… 11 more

java.lang.RuntimeException: Unable to destroy activity {com.playzot.grabbyWord/com.ansca.corona.CoronaActivity}: java.lang.IllegalStateException: Need to intialize chartboost using Chartboost.init() as the application object is null

 
I’ve never seen that one before. 
Is this from your own testing or is it from a user’s device?

It was from 2 user devices reported through google’s crash reporting system.

To me it looks like chartboost.init() failed to initialize properly for those devices, however it’s difficult to tell if that’s the case and why.

I can’t reproduce the issue myself…

It seems to be shutting down though when it tries to init?

To me, it seems to be crashing only when they exit the app. It might just be a glitch in the shutdown sequence and maybe it’s working fine up until then. Not sure what to do since I can’t reproduce it…

Another exception to report on android.  I haven’t been able to reproduce it but google is reporting multiple per day:

java.lang.IllegalStateException: The activity context must be set through the Chartboost onCreate method
at com.chartboost.sdk.b.o(SourceFile:362)
at com.chartboost.sdk.Chartboost.clearCache(SourceFile:503)
at com.chartboost.sdk.Chartboost$a.run(SourceFile:947)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)

Thanks for the report. I’ll put this on the list of observations.

Have you updated your plugin with the latest drop of the chartboost sdk?

Yes. Both the iOS and Android plugin have been updated with the latest SDK from Chartboost (March 17).
You can check if you are using the latest version by printing chartboost.getPluginVersion() from your code.
Android should print 5.1.3 rev 1 and iOS should print 5.1.5 rev 1.

Hello,

I am getting the exact same problem using Chartboost.  I can reproduce it at will on Android. The exact error is as follows:

E/AndroidRuntime( 8095): FATAL EXCEPTION: main

E/AndroidRuntime( 8095): Process: com.gmail.popalzie.TinyCanoeV2, PID: 8095

E/AndroidRuntime( 8095): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gmail.popalzie.TinyCanoeV2/com.chartboost.sdk.CBImpressionActivity}: java.lang.NullPointerException: uriString

E/AndroidRuntime( 8095): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)

E/AndroidRuntime( 8095): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)

E/AndroidRuntime( 8095): at android.app.ActivityThread.access$900(ActivityThread.java:169)

E/AndroidRuntime( 8095): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)

E/AndroidRuntime( 8095): at android.os.Handler.dispatchMessage(Handler.java:102)

E/AndroidRuntime( 8095): at android.os.Looper.loop(Looper.java:146)

E/AndroidRuntime( 8095): at android.app.ActivityThread.main(ActivityThread.java:5487)

E/AndroidRuntime( 8095): at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime( 8095): at java.lang.reflect.Method.invoke(Method.java:515)

E/AndroidRuntime( 8095): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)

E/AndroidRuntime( 8095): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)

E/AndroidRuntime( 8095): at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime( 8095): Caused by: java.lang.NullPointerException: uriString

E/AndroidRuntime( 8095): at android.net.Uri$StringUri.<init>(Uri.java:467)

E/AndroidRuntime( 8095): at android.net.Uri$StringUri.<init>(Uri.java:457)

E/AndroidRuntime( 8095): at android.net.Uri.parse(Uri.java:429)

E/AndroidRuntime( 8095): at com.chartboost.sdk.impl.ao.a(SourceFile:381)

E/AndroidRuntime( 8095): at com.chartboost.sdk.impl.ai$a.<init>(SourceFile:177)

E/AndroidRuntime( 8095): at com.chartboost.sdk.impl.ai$a.<init>(SourceFile:73)

E/AndroidRuntime( 8095): at com.chartboost.sdk.impl.ai.b(SourceFile:546)

E/AndroidRuntime( 8095): at com.chartboost.sdk.f.c(SourceFile:286)

E/AndroidRuntime( 8095): at com.chartboost.sdk.Model.a.k(SourceFile:299)

E/AndroidRuntime( 8095): at com.chartboost.sdk.e.e(SourceFile:75)

E/AndroidRuntime( 8095): at com.chartboost.sdk.e.a(SourceFile:55)

E/AndroidRuntime( 8095): at com.chartboost.sdk.Chartboost.a(SourceFile:920)

E/AndroidRuntime( 8095): at com.chartboost.sdk.c.a(SourceFile:336)

E/AndroidRuntime( 8095): at com.chartboost.sdk.Chartboost.a(SourceFile:255)

E/AndroidRuntime( 8095): at com.chartboost.sdk.CBImpressionActivity.onStart(SourceFile:56)

E/AndroidRuntime( 8095): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1177)

E/AndroidRuntime( 8095): at android.app.Activity.performStart(Activity.java:5461)

E/AndroidRuntime( 8095): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)

E/AndroidRuntime( 8095): … 11 more

I am using interstitial ads (both video and static) and both types of ads will load without issue on Android most of the time, but it will randomly fail with the above error.

The manner in which I am loading the ads is as follows:

function scence:enterScene(event)

.

.

chartboost.cache(“interstitial”)

.

end

function showInterstitialAd()

if not chartboost.hasCachedInterstitial() then

            chartboost.cache( “interstitial” )

            storyboard.gotoScene( “start” )

        else

            chartboost.show( “interstitial” )

        end

end

end

@popalzie

It looks like the app isn’t always initializing properly.

  1. Where do you call chartboost.init()

  2. Are you handing chartboost.startSession() as described here:

https://github.com/swipeware/CoronaChartboostPlugin/blob/modernized/docs/startSession.markdown

@ingemar

****from build.settings****

[“plugin.chartboost”] =

        {

           publisherId = “com.swipeware”,

        }

****from main.lua*****

local chartboost = require( “plugin.chartboost” )

local myAppID        = “xxxxxxmyappIDxxxxxxx”

local myAppSignature = “xxxxx,myAppSignaturexxxxx”

– Change the appid/sig for Android

if system.getInfo( “platformName” ) == “Android” then

    myAppID        = “xxxxxmyAndroidAppIdxxxxxx”

    myAppSignature = “xxxxxmyAndroidAppSignaturexxxxx”

end

– Change the appid/sig for Amazon Kindle

if ( system.getInfo(“model”) == “Kindle Fire” or system.getInfo(“model”) == “KFJWI” ) then

       myAppID        = “xxxxxmyAndroidAppIdxxxxxx”

    myAppSignature = “xxxxxmyAndroidAppSignaturexxxxxx”

end

–ad listener function

local function adListener( event )

  

      if(event.response==“willDisplay”) then

                  

      end

      if(event.response==“didDisplay”) then

      end

      if(event.response==“closed”) then

          if(mydata.mainMenuClicked==true) then

               mydata.mainMenuClicked=false

            storyboard.gotoScene(“start”)

          else

            storyboard.gotoScene(“game”)

          end

          

      end

      if(event.response==“clicked”) then

        storyboard.gotoScene(“start”)

      end

      if(event.response==“cached”) then

                         

      end

      if(event.response==“failed”) then

       

                             

      end

  end

chartboost.init {

        appID        = myAppID,

        appSignature = myAppSignature, 

        listener     = adListener

    }

The following are things that I have found using adb logcat on the device.

  1. The error (the NullPointerException) occurs multiples times simply on loading the app, meaning that even without serving up an ad.  The app doesn’t immediately crash or anything like that at this point, however, the logs clearly show that this error is occurring.

  2. The app can crash on the very first call to load an ad or the ads can be served up just fine n number of times and then the app will crash on the n+1 attempt.  I can typically make it crash after serving up 5 or so ads on a regular basis.

I agree with you that it appears to be related to the initialization and I also think that it has something to do with Android making a decision to force close the application.  I remember seeing something in the log that basically stated that this application has experienced an error x number of times…now closing the app.  The error read something along those lines which made me think that maybe we are exceeding a threshold of error occurrences before Android steps in and forces close the application.  This would also explain the randomness of the problem…not sure though.

-Mayan