Eclipse在我的AndroidManifest.xml中的android:configChanges行上给出了一个错误:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"></activity>
Run Code Online (Sandbox Code Playgroud)
错误是:
error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').
Run Code Online (Sandbox Code Playgroud)
如果我只留下keyboard|keyboardHidden|orientation没有错误,但是当我尝试构建时,编译器会要求剩下的4个.
我正在使用GoogleAdMobAdsSDK-4.3.1.
有任何想法吗?
编辑:我通过将project.properties(SDK的低于14的default.properties)文件更改为:
# Project target.
target=android-14
Run Code Online (Sandbox Code Playgroud)
在我的SDK Manager中安装了SDK平台Android 4.0 - Revision 14.
它也应该适用于SDK平台android 3.2 - 修订版13,所以你只需要将project.properties目标更改为android-13,如果是这样的话.基本上,您只需确保SDK版本为13或更高版本,并且您在SDK管理器中安装了该SDK,并且default/project.properties中的项目目标指向它.
我遇到了将Admob应用到应用程序中的问题.
这是我的main.xml:
Run Code Online (Sandbox Code Playgroud)<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > </LinearLayout> </LinearLayout>
这是我的清单:
Run Code Online (Sandbox Code Playgroud)<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.ollidiemaus.testmob" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="7" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:label="@string/app_name" android:name=".TestAdmobActivity" > <intent-filter > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation"/> </application> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> </manifest>
最后这是我的活动:
Run Code Online (Sandbox Code Playgroud)public class TestAdmobActivity extends Activity { private AdView adView; /** Called when the activity is first created. …
在我之前的问题之后,我已经设法添加和广告横幅到我的应用程序,但当我在模拟器或手机中运行它时,在广告横幅中它说
"你必须在AndroidManifest.xml中使用configChanges声明AdActivity!
在我的清单中我有......
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
Run Code Online (Sandbox Code Playgroud)
这是从下载的示例中复制的....
如果我按照Admob的说明......清单应该是这样的......
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
Run Code Online (Sandbox Code Playgroud)
清单有错误,不会保存..?它说不允许字符串类型?
下面是完整maifest的代码,这是有错误的代码...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.coopersoft.ELcalcV"
android:versionCode="5"
android:versionName="1.1">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".ELcalcV"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Help"
android:label="@string/help_title" >
</activity>
<activity android:name=".About"
android:label="@string/about_title"
android:theme="@android:style/Theme.Dialog">
</activity>
<activity android:name=".CalcV"
android:label="@string/calc_title">
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Run Code Online (Sandbox Code Playgroud)