已经在谷歌上搜索了几个小时,但仍然没有成功。
我总是收到错误消息,而AdBanner没有加载:
There was a problem getting an ad response. ErrorCode: 1
Failed to load ad: 1
平地
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
Android清单
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent"
/>
布局
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
android:layout_marginTop="20dip"
ads:adUnitId="pub-*****************"
android:layout_below="@+id/middle"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
活动(进口)
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
活动
AdView adView = (AdView)findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
还添加了权限
提前向你求助
最佳答案
错误1表示ID错误。
AdMob给你一个这样的号码,是通用ID,带有~:
ca-app-pub-9611919736642270~3440171884
以及广告ID和/是对请求的;
ca-app-pub-9611919736642270/3440171834