首页 > 移动开发 > Android > Unity接入Admob后崩溃:Android Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider:
2021
07-18

Unity接入Admob后崩溃:Android Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider:

在Unity导入Admob插件GoogleMobileAds-v6.0.1.unitypackage后,游戏一运行就崩溃,通过Android Studio调试获得崩溃日志如下:

  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:                                       *
    * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
    * to add a valid App ID inside the AndroidManifest.                          *
    * Google Ad Manager publishers should follow instructions here:              *
    * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
    ******************************************************************************
    
    
        at android.app.ActivityThread.installProvider(ActivityThread.java:6542)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6030)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5936)
        at android.app.ActivityThread.access$1200(ActivityThread.java:200)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1673)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6815)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
     Caused by: java.lang.IllegalStateException:

解决方案: Manifest文件添加如下(<application>标签层中加):

 <meta-data
                android:name="com.google.android.gms.ads.AD_MANAGER_APP"
                android:value="true" />

最后编辑:
作者:搬运工
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。