Unity crashing on Android device when requesting ads

1,306 views
Skip to first unread message

Reboot

unread,
Jan 7, 2016, 3:44:35 PM1/7/16
to Google Mobile Ads SDK Developers
Hello!

I've encountered a problem using the Google Mobile Ads plugin on Android devices. I've got it working perfectly on iOS, however on Android devices the game crashes when an ad is requested. At first I thought it was something I had done, so I made an empty project and followed all the directions using Google's demo script and the game still crashes on device.

I am using Unity 5.2.1, Google Mobile Ads Plugin 2.3.1, and I've made sure to update the Google Play Services and Android Support Library in the SDK Manager. The device I'm using is a Samsung Galaxy Note 2 running Android 4.4.2. But the weird thing is that it works fine on my Galaxy Note 10.1 Tablet, which is also on Android 4.4.2.

I attached the log from the terminal -- sorry if it's large, I'm not really an Android dev so I wasn't sure what was relevant and just included all of it. I noticed when the Unity game launches, it says Google Play Services is out of date, but I put the latest version I had in there. It also appears to be looking for things in android.support.v4 that it can't find.

Thanks!
admob.apk logcat 1-7-16.txt

Veer Arjun Busani

unread,
Jan 7, 2016, 4:16:45 PM1/7/16
to Google Mobile Ads SDK Developers
Hi there,

I would suggest you to add the android.support.v4 library in the Assets -> Plugins -> Android folder and see if that solves the issue. Also make sure that Google Play Services library is in that plugins folder.  

Do let us know if you need anything else. If the issue persists, please send us your minimal project for us to look into further.

Thanks,
Veer Arjun Busani
Mobile Ads SDK Team

Reboot

unread,
Jan 7, 2016, 6:30:38 PM1/7/16
to Google Mobile Ads SDK Developers
Hi Veer, thanks for responding.

I tried what you asked (copied the v4 folder and its contents to the Plugins/Android folder) but it resulted in the same errors. I still see these two in the logcat:

E/dalvikvm( 7863): Could not find class 'android.support.v4.util.ArrayMap', referenced from method com.google.android.gms.common.api.GoogleApiClient$Builder.<init>


I
/dalvikvm( 7863): Could not find method com.google.android.gms.common.api.internal.zzw.zza, referenced from method com.google.android.gms.common.api.GoogleApiClient$Builder.zza

Do you think it might be related to this problem with Galaxy Note 2 phones? The Galaxy Note 2 phone I'm using is just a test device, I could see if I can downgrade it or put a custom ROM on it since the game does work on my tablet.

Anyways, here is a minimal project that just has the ads stuff and the demo script, which is the project I'm using to test the crashing problem. It doesn't have the v4 folder in it because it was still crashing all the same so I removed it again.


Thanks!

Veer Arjun Busani

unread,
Jan 8, 2016, 11:18:41 AM1/8/16
to Google Mobile Ads SDK Developers
Hi there,

I have just downloaded your build and was able to run without any issues on Galaxy 4.4.2 device. Have you tested it on another device to see if the issue persists? The issue could also be due to custom ROM if you are using one on the device. If not, make sure you have Android Support Library and updated the Play Services in the SDK. I would even suggest to run your build through Android Studio simulator to see what the issue might be. I have attached a sample project and an APK that you might try and see if it works. 

Project: Download
APK: Download

Reboot

unread,
Jan 8, 2016, 4:30:58 PM1/8/16
to Google Mobile Ads SDK Developers
I tried the apk you provided and it also crashes on my Note 2. I did a factory reset and reset the cache (it also has the stock ROM), so I guess the problem is with this device. I'll try to find others with this particular device and Android version and see if they have the same issue, and if so I'll try to do some workaround to avoid situations where it might crash.

Thanks for your time!

Veer Arjun Busani

unread,
Jan 8, 2016, 5:11:38 PM1/8/16
to Google Mobile Ads SDK Developers
Hi there,

Try testing on a different device and do let us know if you need any further support on this. 
Reply all
Reply to author
Forward
0 new messages