AdActivity declared in AndroidManifest.xml using ConfigChanges admob android

I am working on an android application and trying to implement sdk adob ad. I did everything that was mentioned in the documentation, but I get the following red error in a black window that should have displayed ads.

You must have declared AdActivity in AndroidManifest.xml using ConfigChanges

I added the following line to AndroidManifest.xml:

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

I tried very hard, but still I can not resolve this error. I am trying to run an application on my xperia phone that has android 4.0.4. Can anyone help me out?

Regads Pankai

+4
source share
3 answers

You need to put this in your manifest:

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

AdViews handles many configuration changes. The official documentation can be found here .

According to unify , Admob is now integrated into Google Play Services. Link to migration can be found here .

+8
source

When updating the response, the package changed to:

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

Full migration link: https://developers.google.com/mobile-ads-sdk/docs/admob/play-migration

+1
source

If you still haven't solved this problem, I suggest that this is because you have to add some permissions for admob to show you ads.

 <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

Add them under the closing </Activity>

Hope this still helps.

0
source

Source: https://habr.com/ru/post/1444739/


All Articles