Google Play Games Services + AdMob = disaster

google play game services (last version 0.9.64) works good in my game when used without AdMob , but when i added AdMob (last version 3.18.0) when i download my game from google play store and click the open button there it show this error “app name has stopped” but the game still work in background i can play it normal and i can open it from the phone widget without that error but this error appears again if i click a button in my game to Sign in to google play services , Ads works good

i tried google game services old version 0.9.53 with AdMobe new version 3.18.0 everything works good i can sign in to gpgs and ads works but the error “app name has stopped” still appear when only game opened from google play store
i may use the oldest versions of gpgs if it’s the only way to make that work but whats the solution for the error “app name has stopped” i still get when game opened from the store ? i tried many things but without success.

Logcat when gpgs and admob last versions are used and i opened the game directly from google play store after downloading it and the "“app name has stopped” error appears :

07-09 20:32:20.903: E/Unity(2689): java.lang.ClassNotFoundException: com.google.android.gms.ads.MobileAds
07-09 20:32:20.903: E/Unity(2689): at java.lang.Class.classForName(Native Method)
07-09 20:32:20.903: E/Unity(2689): at java.lang.Class.forName(Class.java:308)
07-09 20:32:20.903: E/Unity(2689): at java.lang.Class.forName(Class.java:272)
07-09 20:32:20.903: E/Unity(2689): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
07-09 20:32:20.903: E/Unity(2689): at com.unity3d.player.UnityPlayer.c(Unknown Source)
07-09 20:32:20.903: E/Unity(2689): at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source)
07-09 20:32:20.903: E/Unity(2689): at android.os.MessageQueue.next(MessageQueue.java:211)
07-09 20:32:20.903: E/Unity(2689): at android.os.Looper.loop(Looper.java:122)
07-09 20:32:20.903: E/Unity(2689): at com.unity3d.player.UnityPlayer$e.run(Unknown Source)
07-09 20:32:20.903: E/Unity(2689): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAds" on path: DexPathList[[zip file "/data/app/com.Kadev.AppName-1/base.apk"],nativeLibraryDirectories=[/data/app/com.Kadev.AppName-1/lib/arm, /vendor/lib, /system/lib]]
07-09 20:32:20.903: E/Unity(2689): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-09 20:32:20.903: E/Unity(2689): at java.lang.ClassLoader.loadCla```

Logcat when gpgs and admob last version are used and i click sign in to gpgs button then the same error appears :

```07-09 20:10:12.633: W/Unity(31914): OnLevelWasLoaded was found on Reporter
07-09 20:10:12.633: W/Unity(31914): This message has been deprecated and will be removed in a later version of Unity.
07-09 20:10:12.633: W/Unity(31914): Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
07-09 20:10:12.633: W/Unity(31914): 
07-09 20:10:12.633: W/Unity(31914): (Filename: Line: 356)
07-09 20:10:18.273: I/Unity(31914): Ads Request Created
07-09 20:10:18.273: I/Unity(31914): 
07-09 20:10:18.273: I/Unity(31914): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
07-09 20:10:25.003: I/Unity(31914): HandleAdLoaded event received
07-09 20:10:25.003: I/Unity(31914): 
07-09 20:10:25.003: I/Unity(31914): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
07-09 20:10:32.073: I/Unity(31914): Starting Auth with token client.
07-09 20:10:32.073: I/Unity(31914): 
07-09 20:10:32.073: I/Unity(31914): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
07-09 20:10:32.103: W/Unity(31914): !!! [Play Games Plugin DLL] 07/09/19 19:10:32 +00:00 WARNING: Creating new PlayGamesPlatform
07-09 20:10:32.103: W/Unity(31914): 
07-09 20:10:32.103: W/Unity(31914): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)

This means you have missing libraries. Post a screenshot of your Assets/Plugins/Android folder.

1 Like

Try to follow this hint and see if it solves: Latest version paired with latest Google Play Games plugin causes a crash on GPG Authentication · Issue #952 · googleads/googleads-mobile-unity · GitHub

The fact that a major and mandatory change in configuration should be referred as “hint” baffles me but, as I wrote there, I never found that detail anywhere else (especially on the README/release notes…).

1 Like

thanks for your reply
here is the folder files

4733246--448445--libs.PNG

thanks for your reply
he said in that link “ou need to clear your android libraries that were previously resolved and change the play services resolver setting to use Jetifier, then resolve dependencies.”
how ill delete this libraries where ill find them ?
and i didn’t find Jetifier to enable it in android resolver settings

4733252--448448--Jetifier.PNG

I think you overwrote the Google Play Resolver with an older version, is it possible that you installed Google Admob plugin first (which has a newer Google Play Resolver version) and then Google Play Games (which has an older one)?
When you install plugins you should always check the Google Play Resolver version and never downgrade it.
I am on 1.2.122 an there is the “use Jetify” option. Also, before choosing “Settings” in the Google Play Resolver, in the Android sub menu, there is a button to delete all libraries.

Hope this helps :slight_smile:

1 Like

As mentioned, just update play services resolver to above 1.2.119 version and you see an option “uses Jetifier” in the settings.
Usually existing libs will be deleted, if they don’t manually delete them from the menu.

Note that com.android.support.* will be now androidx.* so it will delete almost all existing libs and replace them with androidx.

2 Likes

i tried admob resolver and then gpgs resolver of the newest versions (gpgs 0.9.64 / admob 3.18.0) of this plugins but same problem , can you tell me witch versions you use ??

As mentioned, starting from 1.2.119 version you’ll see the option.

When you import a plugin, you have to always check, when you are importing it and you have the window with all the files, the GooglePlayResolver directory and ensure that you never downgrade it, in that case you have to deselect that directory.
If you want to be sure in your case you can install GPG 0.9.64 and then Admob 3.18.0, because the latter has a newer Google Play Resolver version (1.2.119).

1 Like

yes like what you said guys AdMob google play resolver contain jetify option i tried it but when building an error said that i don’t have sdk 28 while i actually have it , however i edited the proguard file like mentioned here https://github.com/googleads/googleads-mobile-unity/issues/598 now gpgs sign in don’t give error and ads works like what happened when i used an old version of gpgs , but if i click open from google play store for the first time the error of ““app name has stopped”” appears and it looks like my game is crashed but its not i click ok and then i can play my game without any issue , i did a research and i found this https://github.com/googleads/googleads-mobile-unity/issues/960 but do u know how to write that : com.google.android.gms:play-services-measurement:17.0.0com.google.android.gms:play-services-measurement-sdk:17.0.0 in build.gradle file and is that file the one called in unity -main template gradle- file ? thanks all