在 AndroidManifest.xml 中缺少带有 android:configChanges 的 adActivity

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20276027/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:33:50  来源:igfitidea点击:

Missing adActivity with android:configChanges in AndroidManifest.xml

androidadmob

提问by Randa Omar Fahmy

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: configChangesin AndroidManifest.xml" ALTHOUGH I added the Android: configChangesin AndroidManifest.xml

我正在尝试将 admob 横幅添加到我的应用程序,但不幸的是,在完成 Google 文档的所有步骤后,我仍然在 logcat 中收到此警告“找不到com.google.android.gms.ads.adactivity”,并且在 admob 的横幅中收到此消息“ Android: configChangesAndroidManifest 中缺少 adActivity 。 xml” 虽然我Android: configChanges在 AndroidManifest.xml 中添加了

here is my manifest.xml

这是我的 manifest.xml

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

I really need your help

我真的需要你的帮助

回答by Nana Ghartey

com.google.ads.AdActivityis 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:

com.google.ads.AdActivity在“libs”文件夹中使用 admob sdk jar 时声明。您似乎正在通过 google play 服务库使用 admob,因此请更改:

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

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

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

活动 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"/>

回答by Eduardo Dennis

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"/>