Я пытаюсь настроить баннерную рекламу в нижней части главной страницы.Что я делаю не так?
У меня есть это в моей папке AndroidManifest ...
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ca-app-pub-8816120484641057~1397274829]"/>
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true" />
И в моем приложении gradle ...
implementation 'com.google.android.gms:play-services-ads:18.0.0'
implementation 'com.google.android.gms:play-services-measurement:17.0.0'
implementation 'com.google.android.gms:play-services-measurement-sdk:17.0.0'
google () isв моем проекте gradle ...
Я инициализировал объявление ...
private AdView mAdView;
MobileAds.initialize(this, "ca-app-pub-8816120484641057~1397274829");
AdView adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("ca-app-pub-3940256099942544/6300978111");
// TODO: Add adView to your view hierarchy.
mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);\
Вот мой xml ...
<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
ads:layout_constraintBottom_toBottomOf="parent"
ads:layout_constraintEnd_toEndOf="parent"
ads:layout_constraintHorizontal_bias="0.494"
ads:layout_constraintStart_toStartOf="parent"
ads:layout_constraintTop_toBottomOf="@+id/lstNotes"
ads:layout_constraintVertical_bias="0.913" />
Ошибка:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.venturaapps.smartnotes, PID: 31613
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: **************** to add a valid *
* App ID inside the AndroidManifest. Google Ad Manager publishers should *
* follow instructions here: **************** . *
*****************************************************************************