构建应用后 当我在虚拟设备上运行它时,甚至没有打开它,它一直在停止
我检查了日志 我发现了错误,但我无法修复它:(
((((这是错误)))
at android.app.ActivityThread.installProvider(ActivityThread.java:6247)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5810)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5727)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1657)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6499)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:442)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalStateException:
at com.google.android.gms.internal.ads.zzze.attachInfo(Unknown Source:17)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source:3)
at android.app.ActivityThread.installProvider(ActivityThread.java:6244)
... 10 more
答案 0 :(得分:0)
仔细检查您的gradle文件以正确导入广告服务,并将所有依赖项升级到最新版本。请查看Set Up Google Play Services了解更多详细信息。我说这是因为您的错误代码指出:
Caused by: java.lang.IllegalStateException:
at com.google.android.gms.internal.ads.zzze.attachInfo(Unknown Source:17)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source:3)
这似乎表明gms.ads
正在尝试附加,并且来源不明。如果更新依赖项不起作用,请发布gradle文件或更多错误代码。
答案 1 :(得分:0)
像这样在清单文件中添加您的AppId
<manifest>
<application>
<!-- TODO: Replace with your real AdMob app ID -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-################~##########"/>
</application>
https://ads-developers.googleblog.com/2018/10/announcing-v1700-of-android-google.html