Admob没有出现!!一切正确设置

时间:2013-02-12 05:18:14

标签: android

我有 的onCreate() {

adView = new AdView(this, AdSize.IAB_BANNER, "a15119c131293a3");
       AdRequest adRequest = new AdRequest();
           //adLayout is a large linear layout that takes up half of the screen
       LinearLayout adLayout = (LinearLayout)findViewById(R.id.adViewLayout);
       adLayout.addView(adView);
       adView.loadAd(adRequest);

}

然后在清单中我导入了所有权限和admob活动。

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

可能出现什么问题?预先感谢您的帮助。广告根本无法显示。

编辑:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res/com.easyDefinition.googledefinition"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="3dp"
        >
        </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="42dp"
        >

        <TextView
            android:id="@+id/statusTitle"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:text="Define: "
            android:textSize = "20dp"
            android:gravity="center_vertical|center_horizontal"
            android:layout_gravity="center"/>

        <EditText
            android:id="@+id/editTxt2"
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:maxLength="90"
            android:singleLine="true" 
            android:layout_weight="6"
            android:textSize="16dp"
            android:hint= "The word to search"
            android:gravity="center_vertical|center_horizontal"
            android:inputType="textNoSuggestions" >         
            </EditText>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        >
        <Button
            android:id="@+id/googleSearchBtn"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Show the definition"
            android:gravity="center_vertical|center_horizontal"
            android:textSize="12dp"/>

    </LinearLayout>
    <com.easyDefinition.googledefinition.ToolFileListView
        android:id="@+id/fileListView"
        android:layout_width="fill_parent"
        android:layout_height="20dp"/>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/adViewLayout"
        >

    </LinearLayout>
</LinearLayout>

没有Logcat错误

这算了吗?

02-12 00:26:15.223: E/webview(18040): registerForStylusPenEvent onAttachedToWindow
02-12 00:26:15.223: E/webview(18040): registerForStylusPenEvent START
02-12 00:26:15.228: E/webview(18040): registerForStylusPenEvent END

2 个答案:

答案 0 :(得分:1)

当您第一次运行AdMob时,可能不会显示任何内容,因为服务器需要预热&#34;开始向您的应用投放广告。之后,由于没有广告资源,广告仍有可能无法展示。特别是,您正在测试应用的国家/地区可能没有广告资源。

编辑re:热身 根据我的经验,来自应用的前几个广告请求通常会失败。这可能是因为服务器需要分配资源来向以前没见过或最近没见过的应用投放广告。

AdMob documentation有此评论:

  

AdMob第一次看到您的发布商ID时,最多可能需要两分钟才能收到广告。每当ID未使用24小时时,这个最初的两分钟延迟将重复出现。

答案 1 :(得分:0)

试试这个,

在manifest.xml中添加

 <meta-data
    android:name="ADMOB_ALLOW_LOCATION_FOR_ADS"
    android:value="true" />