Crash on App Open

344 views
Skip to first unread message

LSEM

unread,
Sep 8, 2016, 1:50:47 PM9/8/16
to Google Mobile Ads SDK Developers
I've done a lot of searching in the last two days looking at this issue and finally decided to post some information as I haven't found the cause of my error.

I am using Unity 5.3.4p6 with AdMob SDK 3.0.5 along with several supporting GPS aar's (ads, base, basement, gcm) that are all 9.4.0 and SWRVE Unity SDK 4.5.2.

My application builds fine, and doesn't have any JAR/AAR conflicts/duplicates. When I initialize the app, after permissions (location, storage, contacts) and as the app is loading assets it crashes. When I use Android Studios Android Monitor I see the following:

09-08 09:53:06.962 2043-2088/? I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.unity.ads.RewardBasedVideo$1$1>
09-08 09:53:06.962 2043-2088/? I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.unity.ads.RewardBasedVideo$1$1>
09-08 09:53:06.972 2043-2043/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.test.testproject, PID: 2043
                                                 java.lang.Error: FATAL EXCEPTION [main]
                                                 Unity version     : 5.3.4p6
                                                 Device model      : samsung SM-G900W8
                                                 Device fingerprint: samsung/kltevl/kltecan:6.0.1/MMB29M/G900W8VLS1DPF3:user/release-keys
                                                 
                                                 Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/MobileAds;
                                                     at com.google.unity.ads.RewardBasedVideo$1.run(RewardBasedVideo.java:67)
                                                     at android.os.Handler.handleCallback(Handler.java:739)
                                                     at android.os.Handler.dispatchMessage(Handler.java:95)
                                                     at android.os.Looper.loop(Looper.java:158)
                                                     at android.app.ActivityThread.main(ActivityThread.java:7224)
                                                     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)
                                                  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAds" on path: DexPathList[[zip file "/mnt/asec/com.test.testproject-1/base.apk"],nativeLibraryDirectories=[/mnt/asec/com.test.testproject-1/lib/arm, /mnt/asec/com.test.testproject-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
                                                     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                     at com.google.unity.ads.RewardBasedVideo$1.run(RewardBasedVideo.java:67) 
                                                     at android.os.Handler.handleCallback(Handler.java:739) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                     at android.os.Looper.loop(Looper.java:158) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:7224) 
                                                     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) 
                                                  Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.ads.MobileAds
                                                     at java.lang.Class.classForName(Native Method)
                                                     at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                     at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                      ... 9 more
                                                  Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available



What could be the issue? To my knowledge all of the SDKs are up to date and in the Unity project.

Thanks for any help or advice!

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Sep 8, 2016, 2:54:30 PM9/8/16
to Google Mobile Ads SDK Developers
Hi there,

Looking at your trace, it still looks like you might be missing few classes/dependencies. Can you make a new project and make sure that you right click on the Assets folder and select Google Play Services > Resolve Client Jars? Do this once you have imported our plugin and switched to Android platform. Try to build again and let us know. 

Also, I have a sample app for Reward Video Ads and I would suggest you to try it out as well. Determine whether the issue exists with only our plugin and then get back to us and we would have a look at this.

Thanks,
Arjun Busani
Mobile Ads SDK Team

LSEM

unread,
Sep 8, 2016, 4:13:50 PM9/8/16
to Google Mobile Ads SDK Developers
Thanks for the reply,

In my searches I did find the "Resolve Client Jars" and have built with that setting; however, when I run it I have never noticed anything changing in source control (after Saving Project), so I don't believe that is causing any issues. However, if I include the Editor files (including JarResolverLib) in the jenkins build process I do get a set of errors:

Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/export/home/android_tools/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity5.3.4p6/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzek;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzel;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzem;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzgy;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzgz;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzha;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzha$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzhb;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzhl;


So it would then fail at the build step.  I will test with the sampe app that you posted and get back to you.

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Sep 8, 2016, 5:04:42 PM9/8/16
to Google Mobile Ads SDK Developers
Hi there,

So you simply build your project via Jenkins and this is the error? Can you let us know the steps to reproduce this issue?

Thanks,
Arjun Busani
Mobile Ads SDK Team

LSEM

unread,
Sep 8, 2016, 5:26:53 PM9/8/16
to Google Mobile Ads SDK Developers
Yes, in my project if I include the PlayServicesResolver/Editor folder contents then I get that error. If I do not include those Editor files the Jenkins build works correctly and creates a valid APK. However, when I open that APK I get the issue that I originally mentioned. 


I have also looked at the MAD Reward Mediation project you linked and have made a build with no errors or issues opening it, so it is likely that I have made a mistake somewhere in my own project, but I don't see any issues when I compare my project vs. MAD RM.

I should also mention that I have slightly modified the GoogleMobileAdsPlugin/AndroidManifest.xml file based on somebody's suggestion and have commented out the following line:
    <activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
        android:theme="@style/Theme.IAPTheme"/>

If I do not comment the line out I get the following during the Jenkins build process:

stderr[
AndroidManifest.xml:83: error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.IAPTheme').

]

I hope that is not related to the issue I am experiencing. As a reference here are some of the AAR/JAR files I am utilizing.
http://puu.sh/r4xBR/884d49766c.png

http://puu.sh/r4xEh/7010f7c4fe.png

Here is some additional information related to the JarResolver error:
http://puu.sh/r4xNN/882bd1b7d6.png

Thanks.

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Sep 9, 2016, 10:02:26 AM9/9/16
to Google Mobile Ads SDK Developers
Hi there,

Can you make sure that you have updated/installed the following frameworks - Android SDK Builds Tools and Google Play Services? Just make sure that you have updated all of the critical libraries from your Android SDK Manager and make a new project again. 

The reason you were able to build my sample project was because it already came with these libraries. Check in the Assets > Plugins > Android folder in my sample app. Or simply copy those files into your project and give it another shot.

Thanks,
Arjun Busani
Mobile Ads SDK Team

LSEM

unread,
Sep 12, 2016, 4:20:44 PM9/12/16
to Google Mobile Ads SDK Developers
Thank you I think it was missing play-services-ads-lite and it is now working. Do you have a link/repository to the most up to date aar's? The ones included in the SWRVE SDK were google-play-services-*-9.4.0.

Also when I ran the PlayServicesResolver it kept trying to replace the 9.2 versions with 8.4. 

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Sep 12, 2016, 4:24:57 PM9/12/16
to Google Mobile Ads SDK Developers
Hi there,

That's the JAR Resolver trying to load your local Google Play Services frameworks. I would suggest you to open your Android SDK Manager and update your Google Play Services and Android SDK Build Tools libraries and try again.

Thanks,
Arjun Busani
Mobile Ads SDK Team

LSEM

unread,
Sep 13, 2016, 3:06:20 PM9/13/16
to Google Mobile Ads SDK Developers
To me it looks like those are already updated (Google Play Services & Android SDK Build Tools), the only thing not up to date is the Android Support Repository:

http://puu.sh/ra8sY/bc024e433d.png

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Sep 13, 2016, 3:52:05 PM9/13/16
to Google Mobile Ads SDK Developers
Hi there,

Is it the same one being pointed from your Unity IDE as well(Unity > Preferences > External Tools > Android SDK) ?

Thanks,
Arjun Busani
Mobile Ads SDK Team

LSEM

unread,
Sep 13, 2016, 4:39:59 PM9/13/16
to Google Mobile Ads SDK Developers
I am incredibly sorry - no, it is not. It is linking to the previous developers local install. I am sorry for taking up your time. Thank you for the help.
Reply all
Reply to author
Forward
0 new messages