无法使用 Firebase 生成广告横幅。我一直收到错误 "no resource identifier found for Attribute for adUnitID"

Unable to Generate Ad Banner With Firebase. I keep getting error "no resource identifier found for Attribute for adUnitID"

我关注了示例 google 视频以及其他 5 个相关 "How to make a banner" 视频,没有人 运行 解决我的问题。当我将以下代码添加到我的 xml(在相对布局内)

 com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitID="ca-app-pub-9079489398627366/3701601134">
    </com.google.android.gms.ads.AdView>

它要求我添加 xmlns:ads="http://schemas.android.com/apk/res-auto 我这样做一切看起来都很好。编译后出现错误:

Error:(72) No resource identifier found for attribute 'adUnitID' in package 'mypackage'

这是我对其他必要文件所做的: 清单

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

我的java代码:

AdView adView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);

我的gradle:

    android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "willvanbuskirk.com.trumpfactsandquotes"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {

        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
   }

   dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.firebase:firebase-core:9.6.0'
    compile 'com.google.firebase:firebase-ads:9.6.0'

   }
   apply plugin: 'com.google.gms.google-services'

您是否忘记了使用 app_id 进行初始化,而不是 ad_unit_id

 MobileAds.initialize(getApplicationContext(),getString(R.string.adMob_app_id));