user3119384
user3119384

Reputation: 339

Android - InterstitialAd - The Google Play services resources were not found

I am trying to add an InterstitialAd to my project. I have added the necessary library

  1. Downloading google service from sdk manager

  2. Importing the project as android code

  3. Adding it inside the properties>library

Here is my code:

 import com.google.android.gms.ads.*;

 public class MainActivity extends FragmentActivity implements
        ActionBar.TabListener {

    ...
    private InterstitialAd interstitial;



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

        // Create the interstitial.
        interstitial = new InterstitialAd(this);
        interstitial.setAdUnitId("a152caa4c3be05b");

        // Create ad request.
        AdRequest adRequest = new AdRequest.Builder().build();

        // Begin loading your interstitial.
        interstitial.loadAd(adRequest);

        ...

        displayInterstitial();
    }

    ...

    public void displayInterstitial() {
        if (interstitial.isLoaded()) {
          interstitial.show();
        }
      }

 }

and here is the logcat

 01-08 08:30:00.615: D/dalvikvm(669): DexOpt: --- BEGIN 'ads-1769811527.jar' (bootstrap=0) ---
 01-08 08:30:00.705: D/dalvikvm(669): DexOpt: --- END 'ads-1769811527.jar' (success) ---
 01-08 08:30:00.705: D/dalvikvm(669): DEX prep '/data/data/info.androidhive.tabsswipe/cache/ads-1769811527.jar': unzip in 0ms, rewrite 88ms
 01-08 08:30:00.745: I/Ads(669): Use AdRequest.Builder.addTestDevice("5CEAF7E172F8B76E72193FA048D8DCB1") to get test ads on this device.
 01-08 08:30:00.755: I/Ads(669): Starting ad request.
 01-08 08:30:00.945: W/ResourceType(669): getEntry failing because entryIndex 13 is beyond type entryCount 1
 01-08 08:30:00.945: W/ResourceType(669): Failure getting entry for 0x7f0b000d (t=10 e=13) in package 0 (error -2147483647)
 01-08 08:30:00.945: E/GooglePlayServicesUtil(669): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
 01-08 08:30:01.275: W/ResourceType(669): getEntry failing because entryIndex 13 is beyond type entryCount 1
 01-08 08:30:01.275: W/ResourceType(669): Failure getting entry for 0x7f0b000d (t=10 e=13) in package 0 (error -2147483647)
 01-08 08:30:01.275: E/GooglePlayServicesUtil(669): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
 01-08 08:30:01.280: W/ResourceType(669): getEntry failing because entryIndex 13 is beyond type entryCount 1
 01-08 08:30:01.280: W/ResourceType(669): Failure getting entry for 0x7f0b000d (t=10 e=13) in package 0 (error -2147483647)
 01-08 08:30:01.280: E/GooglePlayServicesUtil(669): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
 01-08 08:30:01.505: W/InputMethodManager(669): Ignoring onBind: cur seq=1831, given seq=1830
 01-08 08:30:01.505: W/IInputConnectionWrapper(669): getTextBeforeCursor on inactive InputConnection
 01-08 08:30:01.565: W/IInputConnectionWrapper(669): getTextAfterCursor on inactive InputConnection
 01-08 08:30:01.565: W/IInputConnectionWrapper(669): finishComposingText on inactive InputConnection
 01-08 08:30:01.620: W/IInputConnectionWrapper(669): finishComposingText on inactive InputConnection
 01-08 08:30:02.625: I/Ads(669): Ad finished loading.

It looks like the ads is loading well, but nothing is displayed on the screen. I am not using any other google api (as I have read all the subject about this and people are always having problem when using both adMob and any other google api)

Do you have an idea about how to fix it?

Upvotes: 1

Views: 1651

Answers (3)

ethemsulan
ethemsulan

Reputation: 2319

Go to admob page and create new interstitial(MY_AD_UNIT_ID). Do not use old Banner id.

Maybe this help you: https://support.google.com/admob/v2/answer/3052638?hl=en

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.player);         
  // Create the interstitial.
            interstitial = new InterstitialAd(this);
            interstitial.setAdUnitId(MY_AD_UNIT_ID);

            // Create ad request.
            AdRequest adRequest = new AdRequest.Builder().build();
            interstitial.setAdListener(new AdListener() {
                 @Override
                 public void onAdLoaded() {
                     displayInterstitial();
                 }
                 @Override
                 public void onAdClosed() {
                 }
             });
            // Begin loading your interstitial.
            interstitial.loadAd(adRequest);
      }
     // Invoke displayInterstitial() when you are ready to display an interstitial.
      public void displayInterstitial() {
        if (interstitial.isLoaded()) {
          interstitial.show();
        }
      }

Upvotes: 1

Yoann Hercouet
Yoann Hercouet

Reputation: 17996

I maybe answer a bit late, but I guess the reason might just be that your ad does not have time to load before being showed.

In your code, you want to display the ad right after you loaded it, it does not leave enough time.

You should place the call displayInterstitial(); later in your code.

Upvotes: 0

William
William

Reputation: 20196

A quick search seems to confirm that this

01-08 08:30:00.945: E/GooglePlayServicesUtil(669): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

is a common log emssage with GPS. But it doesn't seem to have impact. Ie it is benign.

Upvotes: 0

Related Questions