Tiago
Tiago

Reputation: 653

unity google play services and admob app crash on open

I'm starting getting crazy so I would like to have your help.

I have one game, that is published and contains Play Services (0.9.50) and GoogleAds for Unity. Now, I have one problem.

When I try to update my game, I have several problems. The same version that was built some months ago, without any changes, when I open the project, I get the following error:

Resolution failed

Failed to fetch the following dependencies:
com.google.android.gms:play-services-auth-games:15.0.1+

So, for that reason, I've tried to update the Play Services for version 0.9.57 and the above error gone, but now I got an warning from Unity.

Some conflicting dependencies were found.
The following dependency versions were modified:
com.google.games:gpgs-plugin-support:0.9.57 --> com.google.games:gpgs-plugin-support:+
com.google.android.gms:play-services-ads:15.0.1 --> com.google.android.gms:play-services-ads:+

The problem is when I build the apk, the app simply crashes after opening. I have nothing more than just that error and the app closes. If I disable play services in my game, it works without any issue, so it seems there's something I'm making wrong with Play Services.

The main goal for my update is some bug fixing and more levels to be added.

Could someone point me in the right direction please? I'm really getting crazy because it seems nothing works...

I've tried several changes and different builds/versions of play services, google mobile ads and even unity without success.

Upvotes: 2

Views: 5727

Answers (6)

Lakshay
Lakshay

Reputation: 1

To implement latest unity ads. you need to make some changes in AndroidMenifest file.

Inside AndroidMenifest.xml
<application>

<meta-data 
//DON'T CHANGE THIS. LEAVE THIS AS IT IS.
android:name="com.google.android.gms.ads.APPLICATION_ID"
//CHANGE THIS TO YOU ID
 android:value="[appid here]"/>

Found a video on this. https://youtu.be/qlRvqi1DAQk

Upvotes: 0

K.Dev
K.Dev

Reputation: 3

hi you can try adding this line in your project

AndroidManifest.xml

inside

<application>

<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="[appid here]"/>

Upvotes: 0

Bijoy Thangaraj
Bijoy Thangaraj

Reputation: 5546

Open you GooglePlayGamesPluginDependencies.xml file and make sure that path mentioned for "com.google.games:gpgs-plugin-support:x.x.xx" exists and is valid.

Upvotes: 0

K.Dev
K.Dev

Reputation: 3

hi in my case i used both Google Play Services (latest version) and Google Mobile Ads (latest release at this time). i include only play game services unity resolver to prevent conflict on manifests. i dont have any errors in editor too , unity succesfully compile the apk. but wwhen testing the game on mobile program suddenly crash and with adb logcat i encountered this error down below. and simply doing these things did the trick and the application started normally on mobile. i hope this will work for you.

Adb Logcat Error:

java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: 

******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
* should follow the instructions here:  to add a valid  *
* App ID inside the AndroidManifest. Google Ad Manager publishers should     *
* follow instructions [here][1]                 *
******************************************************************************


    at android.app.ActivityThread.installProvider(ActivityThread.java:6242)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
    at android.app.ActivityThread.-wrap1(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
 Caused by: java.lang.IllegalStateException: 

******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
* should follow the instructions [here][1]:  to add a valid  *
* App ID inside the AndroidManifest. Google Ad Manager publishers should     *
* follow instructions [here:][1]                           *
******************************************************************************


    at com.google.android.gms.internal.ads.zzmn.attachInfo(Unknown Source:17)
    at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source:3)
    at android.app.ActivityThread.installProvider(ActivityThread.java:6239)

'

Upvotes: 0

Tiago
Tiago

Reputation: 653

In my case it seems to be an issue with Google Play Services (latest version). Using Unity 2017.4.17f1, Google Mobile Ads 3.15.1 (latest release at this time) and Google Play Services 0.9.53 (not the latest release) I don't have any errors in Editor and the app don't crash on run. Left the solution here for anyone that could have the same issue as me.

Upvotes: 0

Awais Chaudhry
Awais Chaudhry

Reputation: 57

Does your app takes network permission while installing on Mobile Device ?

Did you Added Network access permissions in Android-Manifest ? In my case game was crashing when ads were initializing but it was solved when i updated my Android Manifest.

Upvotes: 0

Related Questions