1

Я пытаюсь добавить InterstitialAd в свой проект. Я добавил нужную библиотекуAndroid - InterstitialAd - Ресурсы служб Google Play не найдены

  1. Загрузка Google сервис от SDk менеджера

  2. Импорт проект как андроида код

  3. Добавление его в свойствах> библиотека

Здесь мой код:

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(); 
     } 
     } 

} 

и вот 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. 

Это выглядит как реклама загружается хорошо, но ничего не отображается на экране. Я не использую другие google api (поскольку я прочитал всю тему об этом, и у людей всегда возникают проблемы при использовании как adMob, так и любых других google api)

У вас есть идея, как исправить это?

+0

У меня такая же проблема, может быть, я пропустил некоторые конфигурации шаг ... – Paolo

+0

позже Вы должны вызвать displayInterstitial(). Теперь вы вызываете его в onCreate, и он не может быть загружен завершенным. Попробуйте называть его кнопкой onclick handler или что-то в этом роде. –

ответ

0

Быстрый поиск, кажется, подтверждает, что это

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. 

является общим лог emssage с GPS. Но это, похоже, не влияет. Т.е. он доброкачественный.

+0

Проблема заключается в том, что объявления вообще не отображаются. – user3119384

+0

Уильям прав. Тот же ответ от https://developers.google.com/mobile-ads-sdk/kb/#resourcesnotfound –

0

Возможно, я немного опоздал, но я думаю, причина в том, что ваше объявление не успевает загрузиться, прежде чем его покажут.

В своем коде вы хотите отобразить право сразу после его загрузки, оно не оставляет времени.

Вы должны поместить звонок displayInterstitial(); позже в свой код.

1

Перейти на страницу admob и создать новый интерстициальный (MY_AD_UNIT_ID). Не используйте старый идентификатор Banner.

Может быть, это поможет вам: 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(); 
     } 
     } 
+0

Это то, что исправила мою проблему, я использовал запрещенный идентификатор объявления для своего межстраничного объявления .. Большое вам спасибо, был застрял на этом один на века. – Tssomas

Смежные вопросы