Adding Admob code to Android giving error: You must have AdActivity declared in AndroidManifest.xml(将 Admob 代码添加到 Android 出现错误:您必须在 AndroidManifest.xml 中声明 AdActivity)
问题描述
I'm trying to implement my first ads with Admob. I've read the other posts that seems to be helpful, as well as this: AdMob can't display ads because of configChanges
So I've set the project build target to Android 4.0 (API 14). I've also added this is the project.properties.
# Project target.
target=android-14
Then I've included these lines in AndroidManifest.xml:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
I've also added to required code to display the ad in my activity class. (Like descirbed here: http://code.google.com/intl/de-DE/mobile/ads/docs/android/fundamentals.html)
The problem is that when I run this code, the ad space is showed but with only message that says:
"You must have AdActivity declared in AndroidManifest.xml with configChanges".
The same thing is printed out on the logcat.
Am I ignoring something here? Could anyone with point me some other way?
Set your Build Target to latest you have (>=4) it will work. You can still have minSdkVersion, targetSdkVersion as you like.
The ad will appear after a while, be patient :)
这篇关于将 Admob 代码添加到 Android 出现错误:您必须在 AndroidManifest.xml 中声明 AdActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 Admob 代码添加到 Android 出现错误:您必须在 AndroidManifest.xml 中声明 AdActivity
基础教程推荐
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01