java - java.lang.RuntimeException:无法获取提供程序 com.google.android.gms.ads.MobileAdsInitProvider:java.lang.IllegalStateException:
问题描述
如何在java项目中的android studio 4.0中解决这个问题
我没有在我的项目中使用任何 admob,但它也显示了这个错误。请帮助我尝试了您在上述解决方案中提到的内容。但错误继续....
2020-06-23 00:59:20.816 10332-10332/? W/ample.importcs: Unexpected CPU variant for X86 using defaults: x86
2020-06-23 00:59:22.200 10332-10332/com.example.importcsv E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.importcsv, PID: 10332
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:6988)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6445)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: 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 com.google.android.gms.internal.ads.zzyz.attachInfo(com.google.android.gms:play-services-ads-lite@@19.2.0:33)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@19.2.0:3)
at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
... 10 more```
解决方案
只需将此代码添加到您的应用程序的清单中即可
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
推荐阅读
- log4j2 - 在 log4j2 中为自定义 Header 扩展 PatternLayout
- javascript - 在 JavaScript 中使用 JSONata?
- php - 如何将 Wamp Server 中的本地 PHP 文件和数据库提供给 WAN 即来自其他网络的人?
- asp.net - 无法折叠 asp.net ajax Telerik gridtableview
- git - 我在通过 bitbucket 管道访问 ftp 服务器时遇到问题
- javascript - Ember js #LinkTo 标记及其行为
- html - 如何将 div 绝对定位到其父级?
- java - 启动payara服务器时如何解决以下异常
- apache-spark - 如何在 Pyspark 中将 1000 万条记录的列转换为 20000 条记录的列?
- sql-server - 如何在特定条件下插入和更新?