Missing adActivity with android:configChanges in A

2019-01-17 21:22发布

问题:

I am trying to an admob banner to my application but unfortunately after doing all the steps of the Google documentation I still receive this warning in the logcat "could not find com.google.android.gms.ads.adactivity" and this message in the banner of the admob "Missing adActivity with Android: configChanges in AndroidManifest.xml" ALTHOUGH I added the Android: configChanges in AndroidManifest.xml

here is my manifest.xml

<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

I really need your help

回答1:

com.google.ads.AdActivity is declared when using the admob sdk jar in the "libs" folder. It seems you're using admob via the google play services library so change:

activity android:name="com.google.ads.AdActivity"

To activity android:name="com.google.android.gms.ads.AdActivity"

Also make sure you add the meta-data tag:

<meta-data android:name="com.google.android.gms.version"
           android:value="@integer/google_play_services_version"/>


回答2:

Add this activity to your manifest file

 <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>


标签: android admob