0

広告を表示したい Android アプリを作成していますが、正しく動作させることができません。

を に追加しようとするとconfigChangesAndroidManifest.xml次のエラーが表示されます。これが問題である可能性があります...

error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').

これは私の AndroidManifest.xml ファイルです...

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mysoftwaremobileapps.ParachuteHunterLite"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="3" />
<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:label="@string/app_name"
        android:name=".ParachutehunterActivity" android:screenOrientation="portrait" android:configChanges="orientation">

        <intent-filter >
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:label="@string/app_name" android:name=".GameScreenActivity" android:screenOrientation="portrait" android:configChanges="orientation"></activity>
    <activity android:name=".playerLostMessageActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:configChanges="orientation"></activity>
    <activity android:name="com.mysoftwaremobileapps.ParachuteHunterLite.SubmitScoreActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:configChanges="orientation"></activity>
    <activity android:configChanges="keyboard|keyboardHidden|orientation" android:label="@string/app_name" android:name=".AdActivity" android:screenOrientation="portrait"></activity>
    <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>


</application>

</manifest>

これは、アプリに広告を追加するために使用しているアクティビティです...

package com.mysoftwaremobileapps.ParachuteHunterLite;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;

import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;

public class AdActivity extends Activity implements OnClickListener{
//Called when the activity is first created
Button AdsButton;
public String value;
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.adscreen);
    AdsButton = (Button)findViewById(R.id.AdsButton);
    AdsButton.setOnClickListener(this);
    AdView myAdView = new AdView(this, AdSize.BANNER, "Your Publish ID");

    //get layoutView
    LinearLayout rootView = (LinearLayout)this.findViewById(R.id.MainLayout3);
    LinearLayout.LayoutParams layoutParams = new LayoutParams(320, 50);
    rootView.addView(myAdView, 0, layoutParams);        

    AdRequest re = new AdRequest();
    re.setGender(AdRequest.Gender.UNKNOWN);
    //re.setTestDevices(testDevices);
    //re.setTesting(testing)
    myAdView.loadAd(re);
}
public void onClick(View src) {
    switch(src.getId()) {
    case R.id.AdsButton:
        Uri ParachuteHunterPurchaseSite = Uri.parse("https://play.google.com/store/apps/details?id=com.mysoftwaremobileapps.ParachuteHunter&feature=search_result#?t=W251bGwsMSwyLDEsImNvbS5teXNvZnR3YXJlbW9iaWxlYXBwcy5QYXJhY2h1dGVIdW50ZXIiXQ..");
        Intent launchParachuteHunterPurchaseSite = new Intent(Intent.ACTION_VIEW, ParachuteHunterPurchaseSite);
        startActivity(launchParachuteHunterPurchaseSite);
        break; 
    }
}
}

onClick(AdsButton)メソッドは、Google が提供するActivityとは関係ありません。AdView

4

1 に答える 1

0

エラーについては、アプリケーションにはがありますが、行の一部の値がSDK 13 まで存在しないandroid:configChangesため、不平を言っています。minSdkVerion="3"configChangesscreenSize|smallestScreenSize

http://developer.android.com/reference/android/R.attr.html#configChangesを参照してください。これには、これらの値を ActivityInfo および include/utils/ResourceTypes.h の値と同期させる必要があることが記載されています

これで問題が解決しない場合は、正確に何が機能していないのか教えてください。たとえば、例外やエラーが発生していますか?

于 2012-04-10T14:19:29.170 に答える