按一下方式加入广告为什么就是不行:  
参考与:http://www.eoeandroid.com/thread-1005-1-1.html
我安装了这个例子的apk 也不出广告啊,是怎么回事呢,网络我也打开了
AdMob是一个比较成熟的移动平台广告商,其为android和iphone提供了非常方便的集成JAR包,使得开发者可以在自己的应用中很方便的嵌入其提供的广告,进而按照广告展示和点击次数付广告费。这里用个例子给大家演示下如何在自己的应用中集成AdMob的广告功能。0、准备工作
去http://www.admob.com/注册一个帐号,然后添加一个“Add Mobile Site”,输入相关信息后,提交完成,进入AD代码获取界面,其提供了PHP,Rails等等类型的代码,同时提供了Android平台使用的JAR,我们就来演示这个。1、下载JAR包
其为android平台提供了JAR包,然后将JAR添加到你的项目组,按照如下步骤
Go to the Properties of your project (right-click on your project from the Package Explorer tab and select Properties)
Select "Java Build Path" from left panel
Select "Libraries" tab from the main window
Click on "Add JARs..."
Select the JAR copied to the libs directory
Click "OK" to add the SDK to your android project
2、编辑AndroidManifest.xml
Your AdMob publisher ID was given to you when creating your publisher account on www.admob.com before downloading this code. It is a 15-character code like a14a48e3387c5ce. Just before the closing </application> tag add a line to set your publisher ID:
                <!-- The application's publisher ID assigned by AdMob -->
                <meta-data android:value="YOUR_ID_HERE" android:name="ADMOB_PUBLISHER_ID" />
        </application>Set any permissions not already included just before the closing </manifest> tag:
                <!-- AdMob SDK permissions -->
                <uses-permission android:name="android.permission.INTERNET" />
                <uses-permission android:name="android.permission.READ_PHONE_STATE" />
                <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        </manifest>       
Only the INTERNET permission is required. Setting READ_PHONE_STATE is highly recommended because it identifies the user letting a greater variety of more relevant ads be chosen. Finally setting ACCESS_COARSE_LOCATION (and/or ACCESS_FINE_LOCATION) will let geo-targeted ads be shown.3、添加attrs.xml
The attrs.xml file specifies custom AdView attributes in XML layout files. If your application does not already have an/res/values/attrs.xml file then create one and copy-and-paste the following into it. If you do have that file then just add the declare-styleable element:       
        <?xml version="1.0" encoding="utf-8"?>
        <resources>
                <declare-styleable name="com.admob.android.ads.AdView">
                        <attr name="testing" format="boolean" />
                        <attr name="backgroundColor" format="color" />
                        <attr name="textColor" format="color" />
                        <attr name="keywords" format="string" />
                        <attr name="refreshInterval" format="integer" />
                        <attr name="isGoneWithoutAd" format="boolean" />
                </declare-styleable>
        </resources>4、Placing an AdView in a Layout
AdView widgets can be put into any XML layout now. The first step is to reference attrs.xml in your layout element by adding an xmlns line that includes your package name specified in AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:admobsdk="http://schemas.android.com/apk/res/com.eoeandroid.demo.Adadmob"
android:orientation="vertical" 
android:layout_width="fill_parent"
android:layout_height="fill_parent"><TextView 
android:layout_width="fill_parent"
android:layout_height="wrap_content" 
android:textSize="24px"
android:paddingBottom="10px"
android:layout_gravity="center"
android:text="eoeAndroid  - 最棒的Android开发社区 " />
<TextView 
android:layout_width="fill_parent"
android:layout_height="wrap_content" 
android:textSize="18px"
android:paddingBottom="10px"
android:layout_gravity="center"
android:text="eoeAndroid.com立足于Android开发者,营造一个乐于分享、共同进步的开发者社区." />
<com.admob.android.ads.AdView android:id="@+id/ad"
android:layout_width="fill_parent" 
android:layout_height="wrap_content"
admobsdk:backgroundColor="#000000" 
admobsdk:textColor="#FFFFFF"
admobsdk:keywords="Android application" 
admobsdk:refreshInterval="60"
/>
</LinearLayout>

解决方案 »

  1.   

    在logcat中可以看到原因的,你看看就知道了。
      

  2.   

    logcat上显示的是:Server replied that no ads are available,怎么回事呢?
      

  3.   

    这个我来帮你,我前几天刚做了个:
    不过我用的是有米,不会出现你这个问题:
    1:注册用户,下载jar包: 去 http://www.youmi.net/ 注册个账户,然后 添加一个应用 
    2:在manifest.xml文件中配置:
    <uses-permission android:name="android.permission.INTERNET" />
    3:在你的activity种加入:
       //请务必使用静态的方法初始化AdManager,设置AppId、密码、广告请求间隔和
    //测试模式等参数。
    static{
    //第一个参数是AppId
    //第二个参数是应用密码
    //第三个参数是请求广告的间隔,有效的设置值为30 至200,单位为秒
    //第四个参数是设置测试模式,设置为true 时,广告的展示和点击记录无
    // 效,以测试模式运行。设置为false 时,广告的展示和点
    // 击记录有效,以发布模式运行。请设置为false。
    AdManager.init("df587cb8a2c2a013 ","ef967beb5489644e ",  30, false); AppId 和 应用密码是你在 http://www.youmi.net添加应用后得到的
    4:在res/values 文件夹中添加attrs.xml。
    attrs.xml 文件的内容如下:
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    <declare-styleable name="net.youmi.android.AdView">
    <attr name="backgroundColor" format="color" />
    <!--广告条的纯色背景色-->
    <attr name="startbackgroundColor" format="color" />
    <!--广告条的渐变背景色起始颜色-->
    <attr name="endbackgroundColor" format="color" />
    <!--广告条的渐变背景色的结束颜色-->
    <attr name="clickBackgroundColor" format="color" />
    <!--广告条被点击时的背景色-->
    <attr name="textColor" format="color" />
    <!--字体颜色-->
    <attr name="backgroundTransparent" format="integer"/>
    <!--背景透明度-->
    </declare-styleable>
    </resources>5:在main.xml 中布局有米广告视图。
    以下为一个实例:
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/andro
    id"
    xmlns:umadsdk="http://schemas.android.com/apk/res/net.y
    oum i.HelloYouMi"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content
    " android:textSize="20px"
    android:text="@string/hello"
    />
    <net.youmi.android.AdView
    android:id="@+id/ad"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    umadsdk:textColor="#0fff22"
    umadsdk:backgroundTransparent="155"
    umadsdk:startbackgroundColor="#2B2B2B"
    umadsdk:endbackgroundColor="#63B8FF"
    umadsdk:clickBackgroundColor="#1E90FF"
    />
    </LinearLayout>
    注意:
    xmlns:umadsdk="http://schemas.android.com/apk/res/net.youmi.H
    ell oYouMi"
    这句一定要加上,不然会提示错误。其中net.youmi.HelloYouMi是你应用程序包

    6:请务必在有广告控件的Activity里面重载onDestroy()
    方法,并调用adView.OnDestroy().
    @Override
    protected void onDestroy() {
    // TODO Auto-generated method stub
    super.onDestroy();
    try {
    AdView adView= (AdView) findViewById(R.id.ad);
    if(adView!=null)
    {
    adView.OnDestroy();
    }
    } catch (Exception e) {
    // TODO: handle exception
    }
    }下面是我写的一个例子源码,你可以到我在eoe发的帖子里去下载:
    http://www.eoeandroid.com/viewthread.php?tid=47337&extra=
      

  4.   

    据说Admob很不适合大陆的开发,有很多限制和不便
      

  5.   

    从日志看是服务器没提供给你广告我以前用admob,只收到美元汇票,因为手续费太高,也没去兑换(留做纪念了)。后来转到paypal,又不知道怎么取现,,,,现在换用国内的“有米”,其实国内的广告平台还有一些,每家的点不一样吧,你完全可以选择国内的广告平台,至少取款方便多了,,,
      

  6.   

    看看这个平台真的比较给力,自从用了这个平台收入涨了10几倍,绝对不忽悠,谁用谁知道。
    http://www.waps.cn/news.jsp?id=40068
      

  7.   

    给你一个参考吧,有源码和说明文档http://download.csdn.net/detail/mlqcx/4599193