android - AdMob 与我的应用程序集成

标签 android admob

我正在尝试将 AdMob 集成到我的应用程序中。这是我收到的错误...

02-01 12:34:03.184: E/Ads(23819): The android:configChanges value of the com.google.ads.AdActivity must include screenLayout.
02-01 12:34:03.184: E/Ads(23819): The android:configChanges value of the com.google.ads.AdActivity must include uiMode.
02-01 12:34:03.184: E/Ads(23819): The android:configChanges value of the com.google.ads.AdActivity must include screenSize.
02-01 12:34:03.184: E/Ads(23819): The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.
02-01 12:34:03.184: E/Ads(23819): You must have AdActivity declared in AndroidManifest.xml with configChanges.
02-01 12:34:03.204: I/webview(23819): skipInvalidates
02-01 12:34:03.214: I/webview(23819): skipInvalidates
02-01 12:34:03.224: I/webclipboard(23819): clipservice: android.sec.clipboard.ClipboardExManager@407af360
02-01 12:34:03.714: V/webviewdatabase(23819): TCP pre connection: creating table in database
02-01 12:34:04.064: I/webview(23819): skipInvalidates
02-01 12:34:04.084: I/webview(23819): skipInvalidates
02-01 12:34:04.084: I/webclipboard(23819): clipservice: android.sec.clipboard.ClipboardExManager@407af360
02-01 12:34:04.094: I/webview(23819): skipInvalidates
02-01 12:34:04.254: I/webview(23819): skipInvalidates

这是 Android list

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

    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>


    <application
        android:icon="@drawable/icon5"
        android:label="@string/app_name">
        <activity
            android:label="@string/app_name"
            android:name=".xxx" >
            <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"/>



        <activity android:name="com.xx.xxx.History"></activity>
        <activity android:name="com.xx.xxx.CommandsList"></activity>
        <activity android:name="com.xx.xxx.CommandsHelp"></activity>
    </application>

</manifest>

以上部分的答案

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

现在应用程序执行时没有任何错误,但广告没有显示。这是日志。有人可以告诉我,问题是什么吗?

   02-01 12:49:15.904: I/Ads(24565): To get test ads on this device, call adRequest.addTestDevice("E0AE86FC822746EB3E5BAB6E54B48BCB");
    02-01 12:49:15.984: I/webview(24565): skipInvalidates
    02-01 12:49:16.104: I/Ads(24565): adRequestUrlHtml: 
<html><head>
<script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL(
{"kw":[],"preqs":0,"session_id":"8235404278524521238","u_sd":1,"seq_num":"1","slotname":" a1510b61966655f","u_w":320,"msid":"com.xx.xxx","js":"afma-sdk-a-v6.2.1","mv":"8016010.com.android.vending","isu":"E0AE86FC822746EB3E5BAB6E54B48BCB","cipa":0,"bas_off":0,"format":"320x50_mb","oar":0,"net":"wi","app_name":"3.android.com.xx.xxx","hl":"en","ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"gnt":2,"u_h":480,"carrier":"40413","bas_on":0,"ptime":0,"u_audio":1});</script></head><body></body></html>
    02-01 12:49:17.554: W/webcore(24565): Can't get the viewWidth after the first layout
    02-01 12:49:17.624: W/Ads(24565): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct?
    02-01 12:49:17.634: I/Ads(24565): onFailedToReceiveAd(Invalid Ad request.)

我正在使用 ScrollView 来显示内容。我想在屏幕底部的内容之后显示广告。我在 ScrollView 中使用 LinearLayout。

 <LinearLayout
                android:id="@+id/linearLayout9"
                android:layout_width="match_parent"
                android:layout_height="45px"
                android:layout_marginBottom="2px"
                android:background="#000000" >

                <TextView
                    android:id="@+id/txtViewAdvertisement"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:text="ADVERTISEMENT"
                    android:textSize="16px"
                    android:layout_gravity="center_horizontal" />


                <com.google.ads.AdView android:id="@+id/adView"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         ads:adUnitId=" a1510b619xxxxx"
                         ads:adSize="BANNER"
                         ads:loadAdOnCreate="true"/>



            </LinearLayout>

如果您需要更多信息,请告诉我。

谢谢!!!

看来问题出在我使用的 ScrollView 上。我会问一个单独的问题。接受我的第一部分的答案。

最佳答案

试试这个

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

关于android - AdMob 与我的应用程序集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14641460/

相关文章:

android - Admob 与 Android 中的 simple-xml 集成?

android - 小部件 ListView 未使用 notifyAppWidgetViewDataChanged 进行更新

Android Studio - 奖励视频广告已加载但未显示

iphone - 如何在 iOS 6 上管理 AdMob 行为?

android - 显示在应用程序外部的插页式广告

IOS CollectionView 页脚添加 Google AdMob

java - Android 给出错误 "Cannot fit requested classes in a single dex file"

java - 扩展应用程序的多个类

java - Android - 通过 Html.fromHtml TextView 中的图像?

java - GridView.minHeight 不适用于小项目数