0

这是我第一次使用admob。以下是manifect文件和XML文件

井字游戏.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TableLayout
        android:id="@+id/tableLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:stretchColumns="*" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:text="" />

            <Button
                android:id="@+id/button2"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:text="" />

            <Button
                android:id="@+id/button3"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:text="" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <Button
                android:id="@+id/button4"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:text="" />

            <Button
                android:id="@+id/button5"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:text="" />

            <Button
                android:id="@+id/button6"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:text="" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <Button
                android:id="@+id/button7"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:text="" />

            <Button
                android:id="@+id/button8"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:text="" />

            <Button
                android:id="@+id/button9"
                android:layout_width="wrap_content"
                android:layout_height="100dp"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:text="" />
        </TableRow>
    </TableLayout>




    <com.google.ads.AdView
        xmlns:googleads="http://schemas.android.com/apk/lib/com.google.ads"
        android:id="@+id/ad"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        googleads:adSize="BANNER" 
        android:layout_alignParentBottom="true"
        googleads:adUnitId="a1525bbc8227f4a  " />


</RelativeLayout>

清单文件

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


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

    <application
        android:allowBackup="true"
        android:icon="@drawable/tic_tac_toe_logo"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.xxx.ticktacktoe.MainActivity"
            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="com.google.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation"/>

    </application>

但问题是,每当我运行这个应用程序时,我都会收到以下错误图片,广告应该出现的位置

在此处输入图像描述

LogCat 显示以下错误列表

10-14 15:58:57.500: E/Ads(633): The android:configChanges value of the com.google.ads.AdActivity must include screenLayout.
10-14 15:58:57.500: E/Ads(633): The android:configChanges value of the com.google.ads.AdActivity must include uiMode.
10-14 15:58:57.510: E/Ads(633): The android:configChanges value of the com.google.ads.AdActivity must include screenSize.
10-14 15:58:57.510: E/Ads(633): The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.
10-14 15:58:57.510: E/Ads(633): You must have AdActivity declared in AndroidManifest.xml with configChanges.

为什么我会得到这个?

4

2 回答 2

1

在相对布局中添加此链接

编辑

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

更改您的清单

<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
于 2013-10-14T10:35:32.570 回答
1

您需要声明AdActivity如下(这是您的 logcat 中要求的):

    <activity 
        android:name="com.google.ads.AdActivity" 
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
于 2013-10-14T10:39:57.017 回答