Android studio E/AndroidRuntime:致命异常:主应用程序继续停止?安卓工作室
尝试测试我的横幅添加时出现此错误: E/AndroidRuntime:致命异常:主 进程:com.example.myapplication,PID:6613 java.lang.RuntimeException:无法获取提供程序com.google.android.gms.ads.mobileadsini提供程序:java.lang.IllegalStateException:Android studio E/AndroidRuntime:致命异常:主应用程序继续停止?安卓工作室,android-studio,Android Studio,尝试测试我的横幅添加时出现此错误: E/AndroidRuntime:致命异常:主 进程:com.example.myapplication,PID:6613 java.lang.RuntimeException:无法获取提供程序com.google.android.gms.ads.mobileadsini提供程序:java.lang.IllegalStateException: **********************************************************
******************************************************************************
* Invalid application ID. Follow instructions here: *
* https://googlemobileadssdk.page.link/admob-android-update-manifest *
* to find your app ID. *
******************************************************************************
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:
******************************************************************************
* Invalid application ID. Follow instructions here: *
* https://googlemobileadssdk.page.link/admob-android-update-manifest *
* to find your app ID. *
******************************************************************************
at com.google.android.gms.internal.ads.zzzj.attachInfo(com.google.android.gms:play-services-ads-lite@@19.5.0:24)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@19.5.0:3)
at android.app.ActivityThread.installProvider(ActivityThread.java:7239)
... 10 more
这是我的密码:
Dashboard.java:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard);
/*MobileAds.initialize(this, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(InitializationStatus initializationStatus) {
}
} */
AdView adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("ca-app-pub-3940256099942544/6300978111");
我在舱单上加了这个
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
在布局中,我有:
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
app:adSize="Banner"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
app:layout_constraintBottom_toTopOf="@+id/img"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />