[Unity] Google Mobile Ads crashing on initialization after integrating with Firebase

1,125 views
Skip to first unread message

luiz....@owlbytes.com

unread,
Jan 25, 2019, 9:27:11 AM1/25/19
to google-adm...@googlegroups.com
Hello,
I'm using Unity 2018.3.0.2f, Google Mobile Ads Unity Plugin v3.15.1, Firebase Unity SDK 5.4.4 and Play Services Resolver v1.2.98.0.

I integrated Google Ads into Unity and everything was working properly until I integrated Firebase.
First when I run the Play Services Resolver it had conflicts with google play services version and it fixed. Then I couldn't build and needed to install the newest JDK.

Now when I run the application on my smartphone it crashes. Using logcat I got this info:

01-25 12:01:12.523  2773  4391 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.BabyOwlStudios.StarBotanist/com.unity3d.player.UnityPlayerActivity bnds=[642,864][847,1128]} from uid 10055
01-25 12:01:12.524  2296  2417 I ThermalEngine: Thermal-Server: Thermal received msg from  override
01-25 12:01:12.524   614 18618 I Thermal-Lib: Thermal-Lib-Client: Client request sent
01-25 12:01:12.545  2773  4519 I ActivityManager: Start proc 18621:com.BabyOwlStudios.StarBotanist/u0a240 for activity com.BabyOwlStudios.StarBotanist/com.unity3d.player.UnityPlayerActivity
01-25 12:01:12.551 18621 18621 I zygote  : Late-enabling -Xcheck:jni
01-25 12:01:12.615 18621 18621 D AndroidRuntime: Shutting down VM
01-25 12:01:12.616 18621 18621 E AndroidRuntime: FATAL EXCEPTION: main
01-25 12:01:12.616 18621 18621 E AndroidRuntime: Process: com.BabyOwlStudios.StarBotanist, PID: 18621
01-25 12:01:12.616 18621 18621 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider:java.lang.IllegalStateException:
01-25 12:01:12.616 18621 18621 E AndroidRuntime:
01-25 12:01:12.616 18621 18621 E AndroidRuntime: ******************************************************************************
01-25 12:01:12.616 18621 18621 E AndroidRuntime: * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
01-25 12:01:12.616 18621 18621 E AndroidRuntime: * should follow the instructions here: https://goo.gl/fQ2neu to add a valid  *
01-25 12:01:12.616 18621 18621 E AndroidRuntime: * App ID inside the AndroidManifest. Google Ad Manager publishers should     *
01-25 12:01:12.616 18621 18621 E AndroidRuntime: * follow instructions here: https://goo.gl/h17b6x.                           *
01-25 12:01:12.616 18621 18621 E AndroidRuntime: ******************************************************************************
01-25 12:01:12.616 18621 18621 E AndroidRuntime:
01-25 12:01:12.616 18621 18621 E AndroidRuntime:
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at android.app.ActivityThread.installProvider(ActivityThread.java:6332)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5895)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5816)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at android.app.ActivityThread.-wrap1(Unknown Source:0)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1674)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:105)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6592)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:769)
01-25 12:01:12.616 18621 18621 E AndroidRuntime: Caused by: java.lang.IllegalStateException:
01-25 12:01:12.616 18621 18621 E AndroidRuntime:
01-25 12:01:12.616 18621 18621 E AndroidRuntime: ******************************************************************************
01-25 12:01:12.616 18621 18621 E AndroidRuntime: * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
01-25 12:01:12.616 18621 18621 E AndroidRuntime: * should follow the instructions here: https://goo.gl/fQ2neu to add a valid  *
01-25 12:01:12.616 18621 18621 E AndroidRuntime: * App ID inside the AndroidManifest. Google Ad Manager publishers should     *
01-25 12:01:12.616 18621 18621 E AndroidRuntime: * follow instructions here: https://goo.gl/h17b6x.                           *
01-25 12:01:12.616 18621 18621 E AndroidRuntime: ******************************************************************************
01-25 12:01:12.616 18621 18621 E AndroidRuntime:
01-25 12:01:12.616 18621 18621 E AndroidRuntime:
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at com.google.android.gms.internal.ads.zzze.attachInfo(Unknown Source:17)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source:3)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        at android.app.ActivityThread.installProvider(ActivityThread.java:6329)
01-25 12:01:12.616 18621 18621 E AndroidRuntime:        ... 10 more
01-25 12:01:12.620  2773  3571 W ActivityManager:   Force finishing activity com.BabyOwlStudios.StarBotanist/com.unity3d.player.UnityPlayerActivity
01-25 12:01:12.622  2298  2298 I ADSPD   : Watchdog 2 new value: 0008375d Last Exp Value: ffffffff
01-25 12:01:12.623 18526 18582 E JobManager: error while deserializing job


It says to check this link and I had already done everything mentioned there. For example, here is the manifest.xml, that is the same from when it was working. I hidden the private information.

<?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary activity and permissions
required for displaying ads.
-->
    package="com.google.unity.ads"
    android:versionName="1.0"
    android:versionCode="1">
  <uses-sdk android:minSdkVersion="14"
      android:targetSdkVersion="19" />
  <application>
<meta-data
android:name="com.BabyOwlStudios.StarBotanist"
android:value="ca-app-pub-****************~*********"/>
  </application>
</manifest>

Can you help me with what could be causing this problem?

Also, the integration code is this:
public void Awake()
{
#if UNITY_ANDROID
string appId = testMode ? testAndroidAppID : androidAppID;
TestMode = appId == testAndroidAppID;
#elif UNITY_IPHONE
        string appId = testMode ? testiOSAppID : iOSAppID;
        TestMode = appId == testiOSAppID;
#else
        string appId = "unexpected_platform";
#endif
if (!Initialized)
{
   //Initialize the Google Mobile Ads SDK.
   MobileAds.Initialize(appId);
   Initialized = true;
}
}



Edit: added missing info.

mobileadssdk...@google.com

unread,
Jan 25, 2019, 2:58:41 PM1/25/19
to Google Mobile Ads SDK Developers
Hello Luiz, 

Sure, we will be happy to assist you with this. Could you please share details on the Unity plugin version that you're using? Could you please confirm if you're importing the Firebase SDK into your Unity project following the steps mentioned in this guide? This information will help us troubleshoot the issue.

Thanks,
Bharani Cherukuri
Mobile Ads SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

luiz....@owlbytes.com

unread,
Jan 28, 2019, 10:28:05 AM1/28/19
to Google Mobile Ads SDK Developers
Unity 2018.3.0.2f, Google Mobile Ads Unity Plugin v3.15.1, Firebase Unity SDK 5.4.4 and Play Services Resolver v1.2.98.0.

And yes, I followed the steps

mobileadssdk...@google.com

unread,
Jan 28, 2019, 3:02:14 PM1/28/19
to Google Mobile Ads SDK Developers
Hello Luiz, 

Could you please share the sample project of your implementation, so I can take a look? You can share the details privately via Reply privately to author option. 

Thanks,
Bharani Cherukuri
Mobile Ads SDK Team

mobileadssdk...@google.com

unread,
Feb 11, 2019, 5:02:47 PM2/11/19
to Google Mobile Ads SDK Developers
Hello Luiz, 

Regret the delay. Could you please include the AdMob App ID inside the application tag in the Android Manifest as per this documentation?

    package="com.google.unity.ads"
    android:versionName="1.0"
    android:versionCode="1">
  <uses-sdk android:minSdkVersion="14"
      android:targetSdkVersion="19" />
  <application>
<meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-3940256099942544~3347511713"/>
  </application>
</manifest>

Can you give this a try and let me know if you have any issues?

Thanks,
Bharani Cherukuri
Mobile Ads SDK Team
Reply all
Reply to author
Forward
0 new messages