Admob奖励视频广告无法加载TEST

时间:2018-06-08 05:47:26

标签: java android

我有一个问题,前段时间我开始尝试使用Admob的Rewarded测试广告,一切顺利!现在我想再次尝试测试广告,他们没有出现,我甚至创建了一个新项目,只实现了Rewarded,它不起作用,但是如果我放置了插页式广告,如果它有效。

我已经阅读了无数的出版物,但所有出版物都基于用户ID Admob本身,但不在测试中。

  

始终: onRewardedVideoAdFailedToLoad

这是我制作的新项目的代码:

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");

        // Use an activity context to get the rewarded video instance.
        mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
        mRewardedVideoAd.setRewardedVideoAdListener(this);
        loadRewardedVideoAd();
        if (mRewardedVideoAd.isLoaded()) {
            mRewardedVideoAd.show();
        }
        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

    private void loadRewardedVideoAd() {
        mRewardedVideoAd.loadAd("ca-app-pub-3940256099942544/5224354917",
                new AdRequest.Builder().build());
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onRewarded(RewardItem reward) {
        Toast.makeText(this, "onRewarded! currency: " + reward.getType() + "  amount: " +
                reward.getAmount(), Toast.LENGTH_SHORT).show();
        // Reward the user.
    }

    @Override
    public void onRewardedVideoAdLeftApplication() {
        Toast.makeText(this, "onRewardedVideoAdLeftApplication",
                Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoAdClosed() {
        Toast.makeText(this, "onRewardedVideoAdClosed", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoAdFailedToLoad(int errorCode) {
        Toast.makeText(this, "onRewardedVideoAdFailedToLoad", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoAdLoaded() {
        Toast.makeText(this, "onRewardedVideoAdLoaded", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoAdOpened() {
        Toast.makeText(this, "onRewardedVideoAdOpened", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoStarted() {
        Toast.makeText(this, "onRewardedVideoStarted", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoCompleted() {
        Toast.makeText(this, "onRewardedVideoCompleted", Toast.LENGTH_SHORT).show();
    }

我还补充说:

implementation 'com.google.android.gms:play-services-ads:15.0.1'

和...

maven {
        url "https://maven.google.com"
    }

logcat的:

Fail to instantiate adapter com.google.DummyAdapter
    android.os.RemoteException
        at com.google.android.gms.internal.ads.zzxm.zzbp(Unknown Source)
        at com.google.android.gms.internal.ads.zzxm.zzbo(Unknown Source)
        at com.google.android.gms.internal.ads.zzxm.zzbm(Unknown Source)
        at com.google.android.gms.internal.ads.zzago.zzca(Unknown Source)
        at com.google.android.gms.internal.ads.zzahx.zzdn(Unknown Source)
        at com.google.android.gms.internal.ads.zzajy.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:841)
06-08 02:07:01.761 4917-4917/android.cinemovil.videos W/Ads: Failed to load ad: 3

值得一提的是,在清单中建立了互联网许可证。

我澄清说我只使用Android Studio模拟器。几周前,我做了所有相同的事情,我毫无问题地获得了测试奖励视频。

我在我的非页内广告应用程序中显示没有问题,只有Rewarded它似乎不起作用。

同时尝试放置我的Rewarded用户ID,它仍然无效。 (我的帐户已经显示插页式广告和横幅广告)

0 个答案:

没有答案