android crashes

Hi again,

You need to implement chartboost.startSession() as described in the link below, otherwise Chartboost will not behave properly when resuming from an ad (or resuming after using another app).
https://github.com/swipeware/CoronaChartboostPlugin/blob/modernized/docs/startSession.markdown

The error (the NullPointerException) occurs multiples times simply on loading the app, meaning that even without serving up an ad.

 
That’s strange if it happens on the very first start (not resume). I can’t reproduce such a condition.

Have you tried testing your App ID/SIG with the Corona Chartboost sample app?

If not, please download it and give it a try with your App ID and SIG and monitor the logcat to see if you get the same errors on start.

https://github.com/swipeware/CoronaChartboostSample

NOTE:

It’s difficult to read code that’s pasted as plain text. When pasting code into a post, please use a code block (looks like this “< >” in the menubar). 

@ingemar

Sorry, I didn’t know about the code formatting brackets.  

I think you are absolutely correct!  I had that code in my main.lua file and upon trying to integrate a secondary ad provider I commented it out.  When I switched back to only using Chartboost again, I didn’t “uncomment” that line.

I have fixed this and now I am unable to reproduce the crash!  

I was also unable to reproduce the initial errors that occurred when the app just started so it definitely must have been on resuming the application that I just didn’t notice earlier.

Thanks so much for your help.

@rstupek, my apologies for hijacking your thread (definitely not my intention).  It appeared as though we were facing the same issue.  Hopefully, the recommendation fixes yours as well.

Thanks again.

@popalzie

Hey. Great to hear that your issue is resolved!

@rstupek

The very first error you posted is the same as popalzie’s. Maybe it could be due the same issue of not implementing chartboost.startSession()?

@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.