已经在谷歌上搜索了几个小时,但仍然没有成功。 我总是收到错误消息并且广告横幅无法加载:
There was a problem getting an ad response. ErrorCode: 1
Failed to load ad: 1
构建.gradle
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
Android list
<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" />
Activity (进口)
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
Activity
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
关于android - 无法加载广告(错误 1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38835738/