当我运行我的应用时,我的横幅上出现错误XML attribute adSize was missing
。我的XML代码:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemes.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitID="@string/banner_ad_unit_id"/>
我的onCreate代码:
AdView mAdView = (AdView) findViewById(R.id.adView);
mAdView.setAdSize(AdSize.SMART_BANNER);
mAdView.setAdUnitId("AD_ID");
AdRequest adRequest = new AdRequest.Builder().addTestDevice(Secure.getString(this.getContentResolver(), ANDROID_ID)).build();
mAdView.loadAd(adRequest);
答案 0 :(得分:0)
更改
xmlns:ads="http://schemes.android.com/apk/res-auto"
到
xmlns:ads="http://schemas.android.com/apk/res-auto"
schem a s,而非schem e s