Problems using both AdMob and Google Play Services

418 views
Skip to first unread message

Mattias Carlsson

unread,
Jun 27, 2019, 3:41:17 PM6/27/19
to Google Mobile Ads SDK Developers
I am trying to use both Google Play Services and the AdMob plugin in Unity 2019.1.8f1, building an APK works, but running it on a device results in a crash.

I have attached a log from LogCat and I think this is what causes the crash:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArraySet;

I am using CloudOnce v2.6.8 which in turn uses the play-games-plugin-for-unity v0.9.64 and I am trying to add the admob plugin v.3.18.

I have also uploaded a test project which reproduces the error.

I have tried troubleshooting, but not really gotten anywhere, only found that there have been some commits to the play-games-plugin-for-unity since v0.9.64 was released. Since one change is replacing 
import android.support.annotation.NonNull;
with
import androidx.annotation.NonNull;
is that something that might fix this problem since the error in the log references android/support/v4/....?

I have not been able to test my theory since I don't know how to build a unitypackage from the new source files above and I am not entirely sure if this is the right place to ask this since it might be an issue with the play-games-plugin-for-unity, but I have not found a place to ask the question to those developers.

Thank you in advance!

Best regards,
Mattias
CloudOnce_AdMob_testlog.txt

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 27, 2019, 10:25:21 PM6/27/19
to mat...@thunderboot.com, google-adm...@googlegroups.com
Hi Mattias,

Thank you for reaching out to us, and for providing additional details on your concern.

I was able to compile the provided project file and test the resulting APK. I can also confirm that I was getting the same error, resulting in a crash.

Upon further investigation, it seems that this crash is unrelated to the AdMob SDK, and may be related more to either the CloudOnce API or the play-games-plugin-for-unity library. For context, it may happen that those 2 libraries are still using the old Android Support libraries, while the latest AdMob SDK (v3.18) has already transitioned to using AndroidX libraries. Thus, the Android Support libraries get superseded by the newer AndroidX libraries once dependencies are resolved.

Since third-party libraries are out-of-scope for our level of provided support, you may contact the support of those libraries for further assistance.

Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team

ref:_00D1U1174p._5001UCZtBm:ref

Mattias Carlsson

unread,
Jun 27, 2019, 11:48:53 PM6/27/19
to Google Mobile Ads SDK Developers
Thank you for the quick reply.

If I were to use an old version of the AdMob plugin for Unity that has not yet migrated to AndroidX libraries, which release should that be? (Just until the other plugins are updated as well).

Best regards,
Mattias

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 28, 2019, 2:05:59 AM6/28/19
to mat...@thunderboot.com, google-adm...@googlegroups.com
Hi Mattias,

As per our page on Unity AdMob SDK releases, you may try downgrading to v3.17. Let me know if this works for you.

Mattias Carlsson

unread,
Jun 29, 2019, 2:40:13 AM6/29/19
to google-adm...@googlegroups.com
Thank you again.

I tried version 3.17 and after adding my AdMob app Id to the correct AndroidManifest.xml file it worked together with the CloudOnce v2.6.8 which in turn uses the play-games-plugin-for-unity v0.9.64.

Since v3.17 does not have the configuration menu item in Unity, where should I add the iOS app Id for AdMob? The website explaining how to configure AdMob in Unity only shows the editor menu item.

(I have created an issue for the play-games-plugin-for-unity here)

Best regards,
Mattias

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 30, 2019, 8:14:25 PM6/30/19
to mat...@thunderboot.com, google-adm...@googlegroups.com
Hi Mattias,

Thank you for confirming that the v3.17 of the Unity AdMob plugin works with your setup.

I'm afraid that the page for getting started on Unity has in fact already been updated for v3.18 of the plugin. That said, you may try visiting the same link on an archiving site like the Wayback Machine; I was able to retrieve the page of interest by visiting its archived version dated May 08, 2019.
Reply all
Reply to author
Forward
0 new messages