“ E / Ads:等待未来时出错”使用模拟器测试AdMob时发生错误 [英] "E/Ads: Error waiting for future" error when testing AdMob with emulator

查看:104
本文介绍了“ E / Ads:等待未来时出错”使用模拟器测试AdMob时发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照所有必需的步骤在模拟器上测试AdMob,但日志上出现以下错误:

  E /广告:等待未来时出错。 
java.util.concurrent.ExecutionException:java.util.concurrent.TimeoutException
在com.google.android.gms.internal.ads.z​​zaoj.get(未知来源:35)
在com.google.android.gms.internal.ads.z​​zano.zza(未知来源:19)
在com.google.android.gms.internal.ads.z​​zafn.zza(未知来源:621)
在com.google.android.gms.internal.ads.z​​zafn.zzb(未知来源:6)
在com.google.android.gms.internal.ads.z​​zafp.run(未知来源:4)
在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:457)
在java.util.concurrent.FutureTask.run(FutureTask.java:266)
在java。 util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:636)
在java.lang.Thread.run( Thread.java:764)
造成原因:com.google.android.gms.internal.ads.z​​za上的java.util.concurrent.TimeoutException
ns.run(未知来源:4)java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:457)中的
java.util.concurrent.FutureTask.run(FutureTask.java)中的
:266)java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
b在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:636)
在java.lang.Thread.run(Thread.java:764)
W / Ads:有一个收到广告回应时出现问题。错误代码:0
广告:无法加载广告:0

XML代码如下:

 < RelativeLayout xmlns:android = http://schemas.android.com/apk/res/android 
xmlns:tools = http://schemas.android.com/tools
android:layout_height = match_parent
android:layout_width = match_parent
工具:context = .MainActivity>

< TextView android:text = Hi
android:layout_width = wrap_content
android:layout_height = wrap_content />

< com.google.android.gms.ads.AdView
xmlns:ads = http://schemas.android.com/apk/res-auto
android:id = @ + id / adView
android:layout_width = wrap_content
android:layout_height = wrap_content
android:layout_centerHorizo​​ntal = true
android: layout_alignParentBottom = true
ads:adSize = BANNER
ads:adUnitId = @ string / banner_id>
< /com.google.android.gms.ads.AdView>

< / RelativeLayout>

活动代码为:

  import android.support.v7.app.AppCompatActivity; 
import android.os.Bundle;

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;

公共类MainActivity扩展了AppCompatActivity {

私人AdView mAdView;

@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

MobileAds.initialize(this,
getResources()。getString(R.string.app_ad_id));
mAdView = findViewById(R.id.adView);
AdRequest adRequest =新的AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
mAdView.loadAd(adRequest);
}
}

我尝试降低play-services-ads到版本12的依赖关系实现中,请确保已将权限添加到清单,已更新的google服务播放以及Android Studio上的android图像上是否已更新;还确保我的帐户在AdMob上处于活动状态,并且adUnits在活动状态,但是仍然存在相同的问题
预先感谢您的帮助

解决方案

这就是Google所说的
我早就遇到了这个问题!我通过等待解决了!而且也不会显示实时广告,只会给您一个虚拟的admob补充,只是告诉它可以正常工作!



简单地说!



可能是您最近才创建了一个新的广告单元ID并请求投放实时广告。在这种情况下,可能要花几个小时才能开始投放广告。如果您正在接收测试广告,那么您的实施就可以了。请稍等几个小时,然后查看您是否可以接收实时广告。否则,可以将您的广告单元ID发送给我们,以便我们进行调查。



所以基本上您必须等待几个小时



请检查



检查此 线程 以获取更多提示


I followed all required procedures to test AdMob on emulator but I'm having following error on the log:

E/Ads: Error waiting for future.
   java.util.concurrent.ExecutionException: java.util.concurrent.TimeoutException
       at com.google.android.gms.internal.ads.zzaoj.get(Unknown Source:35)
       at com.google.android.gms.internal.ads.zzano.zza(Unknown Source:19)
       at com.google.android.gms.internal.ads.zzafn.zza(Unknown Source:621)
       at com.google.android.gms.internal.ads.zzafn.zzb(Unknown Source:6)
       at com.google.android.gms.internal.ads.zzafp.run(Unknown Source:4)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764)
    Caused by: java.util.concurrent.TimeoutException
       at com.google.android.gms.internal.ads.zzans.run(Unknown Source:4)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
       at java.lang.Thread.run(Thread.java:764) 
W/Ads: There was a problem getting an ad response. ErrorCode: 0
W/Ads: Failed to load ad: 0

XML Code as follow:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
tools:context=".MainActivity">

<TextView android:text="Hi"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content" />

<com.google.android.gms.ads.AdView
  xmlns:ads="http://schemas.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_id">
</com.google.android.gms.ads.AdView>

</RelativeLayout>

The Activity Code is:

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;

public class MainActivity extends AppCompatActivity {

  private AdView mAdView;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      MobileAds.initialize(this,
              getResources().getString(R.string.app_ad_id));
      mAdView = findViewById(R.id.adView);
      AdRequest adRequest = new AdRequest.Builder()
        .addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
    mAdView.loadAd(adRequest);
  }
}

I've tried to lower play-services-ads to version 12 in dependencies implementation, made sure permissions added to manifest, updated google service play and android images on the Android studio to latest update; also made sure that my account is active on AdMob and adUnits are active, yet still having same issue Thanks in advance for your help

解决方案

This is what google says I had that problem way back ! I solved it by waiting! and also it will not show live ads it will just give you a dummy add of admob just to tell that it is working!

in simple words!

"It could be that you have only recently created a new Ad Unit ID and requesting for live ads. It could take a few hours for ads to start getting served if that is that case. If you are receiving test ads then your implementation is fine. Just wait a few hours and see if you are able to receive live ads then. If not, can send us your Ad Unit ID for us to look into."

so basically you have to wait for a few hours

CHECK the LINK for resource that I talked about from GOOGLE

IF THE PROBLEM STILL PRESISITS

then do these one by one and check the app

  1. Try checking your UNIT ID maybe that's wrong

  2. Try checking the package name you provided is the same on the admob side

  3. try testing by the emulator by telling the admob to test on emulator using this

    AdRequest adRequest = new AdRequest.Builder().addTestDevice(your device id) //When you testing on emulator .addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();

4:check your app's manifest has that metaTag where you tell about google play version

CHECK THIS THREAD FOR MORE TIPS

这篇关于“ E / Ads:等待未来时出错”使用模拟器测试AdMob时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆