當我試圖讓AdMob的6對Android 2.2的工作,我看到一個紅色和黑色的盒子,上面寫着「你必須有AdActivity在AndroidManifest.xml宣佈與configChanges」AdMob聯播6在Android 2.2不工作
哪有我解決這個問題?
我粘貼下面所有的代碼,所以沒有混淆。 在我無法在我的應用中使用它之後,我創建了一個專門用於解決這個問題的單獨項目。
清單:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.valgriz.AdMobTest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="13" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode" >
</activity>
<activity
android:name=".Main"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
佈局:
<?xml version="1.0" encoding="utf-8"?>
<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" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="MYADCODE"
ads:loadAdOnCreate="true" />
</LinearLayout>
的Java(不重要):
package com.valgriz.AdMobTest;
import android.app.Activity;
import android.os.Bundle;
public class Main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
由於某種原因,它仍然不工作,我仍然看到該消息。 還有什麼可以工作嗎? – Steven 2012-07-21 00:56:05
你準備好了嗎? https://developers.google.com/mobile-ads-sdk/docs/android/fundamentals#requirements我記得在最後一次SDK更新之後必須添加這個。我添加了來自android-sdk-windows \ extras \ google \ admob_ads_sdk \ GoogleAdMobAdsSdk-6.1.0.jar的外部Jar – Sobo 2012-07-21 01:10:21
是的,我導入了庫...這讓我非常惱火......現在我只想廣告添加併發布我的應用。 感謝您的幫助, – Steven 2012-07-21 01:20:10