AdMob横幅不适用于移动数据 [英] AdMob Banner not working on mobile data
问题描述
我最近开始在Android应用程序开发中尝试在我的应用程序中加载横幅时遇到logcat中的以下错误。
03-02 17:30:58.509:我/广告(12181):使用AdRequest.Builder.addTestDevice(我的设备ID)在此设备上获取测试广告。
03-02 17:30:58.509:我/广告(12181):启动广告请求。
03-02 17:30:58.799:W /广告(5515):连接到广告服务器时出错:60000ms后无法连接到googleads.g.doubleclick.net/74.125.225.250(端口80):isConnected失败:ENETUNREACH(网络无法访问)
03-02 17:30:58.799:W /广告(12181):获取广告响应时出现问题。 ErrorCode:2
03-02 17:30:58.939:I / Ads(12181):从现在开始计划60000毫秒的广告刷新。
03-02 17:30:58.939:W / Ads(12181):无法加载广告:2
它仅在某些设备(主要是Android 4.1 Jelly Bean)中发生,并且仅在移动数据(使用TelcelMéxico)上发生,它在WiFi上按预期工作。
我的xml和java代码与AdMob实现指南相同。
layout.xml横幅
< com.google.android.gms.ads.AdView
android:id =@ + id / adView
android:layout_width =wrap_content
android:layout_height =wrap_content
android:layout_alignParentBottom =true
android:layout_centerHorizontal =true
ads:adSize =BANNER
ads:adUnitId = 我的添加单元ID(隐藏)/>
MainActivity onCreate方法
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdView adView =(AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()。build();
adView.loadAd(adRequest);
}
希望你能帮我解决这个问题。
如果日期或时间错误,则会显示错误2
只需在设备上设置自动更正。如果设备上的时间与Google服务上的时间不相等,则会显示错误2。这就是你需要的全部
I've recently started in Android App developing and I'm a getting the following error in logcat when trying to load the banner in my app.
03-02 17:30:58.509: I/Ads(12181): Use AdRequest.Builder.addTestDevice("My device ID") to get test ads on this device.
03-02 17:30:58.509: I/Ads(12181): Starting ad request.
03-02 17:30:58.799: W/Ads(5515): Error while connecting to ad server: failed to connect to googleads.g.doubleclick.net/74.125.225.250 (port 80) after 60000ms: isConnected failed: ENETUNREACH (Network is unreachable)
03-02 17:30:58.799: W/Ads(12181): There was a problem getting an ad response. ErrorCode: 2
03-02 17:30:58.939: I/Ads(12181): Scheduling ad refresh 60000 milliseconds from now.
03-02 17:30:58.939: W/Ads(12181): Failed to load ad: 2
It only happens in certain devices (Mostly in Android 4.1 Jelly Bean) and only on mobile data (Using Telcel México), it works as expected on WiFi.
My xml and java code is the same as the AdMob implementation guide.
layout.xml banner
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="My Add Unit Id (Hidden)" />
MainActivity onCreate Method
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
Hope you can help me solve this.
Error 2 appears if date or time is wrong Just set autodate correcting on your device. Error 2 appears if time on your device is not equals with time on google service. It's all what you need
这篇关于AdMob横幅不适用于移动数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!