Android AdMob错误在调用load之前,必须设置广告尺寸和广告单元ID

Luk*_*ley 2 android admob

嗨,我正在尝试将广告添加到我的应用程序中,但我一直收到错误

The ad size and ad unit ID must be set before load is called.
Run Code Online (Sandbox Code Playgroud)

继续我到目前为止所尝试的内容

继承我的布局(我有我在我的应用程序中放入xml的实际adUnitId号码,但是没有把它放在这里,因为我认为在线发布它不是一个好主意)

<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:id="@+id/levelView" 
     >

     <RelativeLayout 
      android:id="@+id/header" 
      android:layout_width="match_parent"
      android:layout_height="70dp"
      >


          <TextView
            android:id="@+id/tv1"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
           android:layout_marginTop="5dp"
            android:textSize="15dp"
            android:textColor="@color/white"
            android:text="hello"
            android:gravity="center"
            android:singleLine="true"/>

         <TextView
            android:id="@+id/headertitle"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
             android:layout_below="@+id/headertitle"
           android:textSize="40dp"
            android:textColor="@color/white"
            android:layout_marginTop="15dp"
            android:text="2014"
            android:gravity="center"
            android:singleLine="true"/>

         <ImageView
             android:id="@+id/imageView1"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_centerVertical="true"
             android:layout_marginLeft="18dp"
             android:layout_toRightOf="@+id/headertitle"
             android:src="@drawable/level_logo" />

    </RelativeLayout>


   <GridView
        android:id="@+id/gridView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/header"
        android:numColumns="4"
        android:listSelector="@null"
        android:layout_centerHorizontal="true" >
    </GridView>



  <com.google.android.gms.ads.AdView android:id="@+id/adView"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:layout_below="@+id/gridView1"
                         ads:adUnitId="MY ID NUMBER"
                         ads:adSize="BANNER"/>



</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

然后在我的onCreate()中运行以下函数

 public void loadAds(){
        // Look up the AdView as a resource and load a request.
        AdView adView = (AdView)this.findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        adView.loadAd(adRequest); 
        }
Run Code Online (Sandbox Code Playgroud)

有谁知道错误意味着什么,我该如何解决?

Lib*_*bin 13

更改xmlns:ads架构

 xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
Run Code Online (Sandbox Code Playgroud)

 xmlns:ads="http://schemas.android.com/apk/res-auto"
Run Code Online (Sandbox Code Playgroud)