当前位置: 动力学知识库 > 问答 > 编程问答 >

Android Admob android Manifest error

问题描述:

I am trying to put ads into my Android application, but I'm getting a weird error.

My app launches with this in the Manifest file. But it shows an error in the emulator saying

"You must have AdActivity declared in the AndroidManifest.xml with configChanges."

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

android:configChanges="keyboardHidden|orientation|keyboard"/>

Whenever I add this to the Manifest file I cannot compile.

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

android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

网友答案:

The easiest part at first: you are missing a few flags in the configChanges attribute of the definition of the AdActivity in your AndroidManifest.xml. As shown in the AdMob SDK Docs the definition needs to look like this:

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

The second -- Investigated the reason is because these three attributes in the latest SDK (> = 13) support, the project properties are set with Android2.2 solution is as follows:

a: Upgrade ADT to download the latest SDK

b: the API to modify the Project Build Target Level, its value must be> = 13, I chose to Android 4.0. Modify these steps: Right-click on the item, and select Properties -> Android -> Android 4.0

c: Modify the the AndroidManifest.xml of the targetSdkVersion and minSdkVersion value is the value of their own needs

<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="7"/>  

for more help see

分享给朋友:
您可能感兴趣的文章:
随机阅读: