Error onRewardedVideoAdFailedToLoad Admob Interstitial rewarded Android Studio

1

I'm implementing Admob Interstitial, rewarded in Android Studio, but I have this error when I want to upload the ad:

  

onRewardedVideoAdFailedToLoad.

I'll let you join the code captures and the admob settings.

package com.android.proyect;

import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.reward.RewardedVideoAd;

import static android.graphics.BitmapFactory.decodeResource;
import static android.view.Window.FEATURE_LEFT_ICON;

public class Welcome extends AppCompatActivity{


    private RewardedVideoAd mRewardedVideoAd;
    private static final String AD_UNIT_ID = "ca-app-pub-000000000000000/00000000"; //My code

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // Get the view from singleitemview.xml
        setContentView(R.layout.activity_welcome);

        probarboton = (Button) findViewById(R.id.button4);

        //Anuncio probar video
        mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
        mRewardedVideoAd.setRewardedVideoAdListener(new RewardedVideoAdListener()
        {

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

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

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

            @Override
            public void onRewardedVideoAdClosed()
            {
                Toast.makeText(Welcome.this, "onRewardedVideoAdClosed", Toast.LENGTH_SHORT).show();
                // Preload the next video ad.
                loadRewardedVideoAd();
            }

            @Override
            public void onRewarded(RewardItem rewardItem)
            {
                textView4.setText(String.format(Locale.getDefault(),"you got %d %s!", rewardItem.getAmount(), rewardItem.getType()));
            }

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

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

        probarboton.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View arg0)
            {
                Log.i("probar","video");
                System.out.println("click boton probar video");
                if (mRewardedVideoAd.isLoaded()) {
                    mRewardedVideoAd.show();
                }
            }
        });

        requestNewInterstitial();
        loadRewardedVideoAd();
    }

    private void loadRewardedVideoAd() {
        AdRequest adRewardRequest = new AdRequest.Builder()
                .build();
        mRewardedVideoAd.loadAd(AD_UNIT_ID, adRewardRequest );
    }

}

build.gradle project

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.2'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

build.gradle app

    dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.koushikdutta.ion:ion:2.1.9'
    compile 'com.android.support:support-vector-drawable:24.2.1'
    compile 'com.github.snowdream.android:smartimageview:0.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services-ads:9.4.0'
    compile 'com.google.firebase:firebase-ads:9.4.0'
    compile 'com.google.firebase:firebase-core:9.4.0'
    compile 'com.google.firebase:firebase-messaging:9.4.0'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile files('libs/UnityAdsAdapter.jar')

}
apply plugin: 'com.google.gms.google-services'

Admob configuration

Unity Ads configuration

LogCat Error

I/Ads: Starting ad request.
W/Ads: There was a problem getting an ad response. ErrorCode: 0
W/Ads: Failed to load ad: 0

Layout Code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:circular="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.badwolf.satoshimaker.Welcome"
tools:showIn="@layout/activity_welcome">

<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ReclaimBit"
android:layout_toRightOf="@+id/history"
android:layout_toEndOf="@+id/history"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
android:id="@+id/button4" />

</RelativeLayout>
    
asked by juansanchez1993 05.11.2016 в 11:46
source

1 answer

0

The error onRewardedVideoAdFailedToLoad occurs due to an error when loading the advertisement, in the LogCat the problem is specified, add more information.

Add the correct AdUnit , if you are in development and do not add the correct id this would be displayed in the LogCat.

The AdUnit specified is incorrect:

AD_UNIT_ID = "ca-app-pub-000000000000000/00000000"; 
    
answered by 05.11.2016 в 14:59