我在 android 上运行我的计算器应用程序时遇到问题

时间:2021-03-20 21:07:00

标签: java android gradle

$ adb shell am start -n "me.zanecoleriley.calculator/me.zanecoleriley.calculator.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER 连接到设备 'emulator-5554' 上的进程 7940。 捕获并显示来自应用程序的 logcat 消息。可以在“调试器”设置页面的“Logcat 输出”部分禁用此行为。 D/NetworkSecurityConfig:未指定网络安全配置,使用平台默认值 D/NetworkSecurityConfig:未指定网络安全配置,使用平台默认值 D/AndroidRuntime:关闭虚拟机 E/AndroidRuntime:致命异常:主要 进程:me.zanecoleriley.calculator,PID:7940 java.lang.RuntimeException:无法获取提供程序 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:7244)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
    at android.app.ActivityThread.access$1300(ActivityThread.java:237)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
 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.zzyc.attachInfo(com.google.android.gms:play-services-ads-lite@@19.1.0:33)
    at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@19.1.0:3)
    at android.app.ActivityThread.installProvider(ActivityThread.java:7239)
        ... 10 more

我试图修复它无济于事

1 个答案:

答案 0 :(得分:0)

您是否尝试在 AndroidManifest.xml 文件的应用程序标记中添加 android:usesCleartextTraffic="true"?还可以尝试在您的应用程序标签上添加 <uses-permission android:name="android.permission.INTERNET" />

如果这没有帮助,你也可以试试这个:https://developer.android.com/training/articles/security-config.html