未发现谷歌播放业务资源。 “AdsMob”发现、业务、资源、AdsMob

2023-09-09 22:01:47 作者:Keys(琴键)

当我尝试加载和InterstitialAd从谷歌的AdMob我收到此错误。我知道我已经正确地写入code。正如我跟着上 https://developers.google了简短的教程。

COM /移动广告的SDK /文档/ AdMob的/高级#播放

所有的情况是我在logcat中得到和错误。什么可能我是做错了。

下面是code:

 公共类preF扩展preferenceActivity工具
        共享preferences.OnShared preferenceChangeListener {

    / **的视图,以显示广告。 * /
      私人AD浏览报AD浏览报;

      / *您的广告单元ID。请用您的实际广告单元ID。 * /
      私有静态最后弦乐AD_UNIT_ID =MY_ID;
      私有静态最后弦乐inAD_UNIT_ID =MY_ID;
      私人InterstitialAd间质性;


    @燮pressWarnings(德precation)
    保护无效的onCreate(包paramBundle){
        super.onCreate(paramBundle);
        的setContentView(R.layout.ad_layout);


        //add$p$pferencesFromResource(R.xml.$p$pferences);
        //获取preferenceManager()
                //.setShared$p$pferencesName("com.gordondev.south_korea);
        //添加preferencesFromResource(2130903040);
        //获取preferenceManager()。getShared preferences()
            // .registerOnShared preferenceChangeListener(本);

        //创建间隙。
        间质性=新InterstitialAd(本);
        interstitial.setAdUnitId(inAD_UNIT_ID);

        //创建广告请求。
        AdRequest adRequest =新AdRequest.Builder()建立()。

        //开始加载你的间质。
        interstitial.loadAd(adRequest);

        //创建一个广告。
        AD浏览报=新的AD浏览报(本);
        adView.setAdSize(AdSize.BANNER);
        adView.setAdUnitId(AD_UNIT_ID);

        // AD浏览报添加到视图层次结构。该视图将没有大小
        //直到广告被加载。
        的LinearLayout布局=(的LinearLayout)findViewById(R.id.adview);
        layout.addView(AD浏览报);

        //((LinearLayout)view).addView(adView);

        //创建一个广告请求。检查的logcat输出哈希设备ID为
        //得到一个物理设备上测试广告。
        AdRequest adRequest1 =新AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice(INSERT_YOUR_HASHED_DEVICE_ID_HERE)
            。建立();

        //开始在后台加载的广告。
        adView.loadAd(adRequest1);


    }

    //调用displayInterstitial(),当您准备好显示间隙。
      公共无效displayInterstitial(){
        如果(interstitial.isLoaded()){
          interstitial.show();
        }
      }
 
Google Discovery Ads 对全球广告客户开放了

下面是logcat的错误:

  03-13 16:49:41.565:I /广告(29755):使用AdRequest.Builder.addTestDevice(099098AA8954CC0C01AD412143D81BDD),以获得在该设备上测试广告。
03-13 16:49:41.565:I /广告(29755):启动广告请求。
03-13 16:49:41.575:E / GooglePlayServicesUtil(29755):在谷歌播放均未发现服务的资源。检查项目配置,以确保资源被包括在内。
03-13 16:49:41.575:I /广告(29755):使用AdRequest.Builder.addTestDevice(099098AA8954CC0C01AD412143D81BDD),以获得在该设备上测试广告。
03-13 16:49:41.575:I /广告(29755):启动广告请求。
03-13 16:49:41.585:E / GooglePlayServicesUtil(29755):在谷歌播放均未发现服务的资源。检查项目配置,以确保资源被包括在内。
03-13 16:49:41.625:E / GooglePlayServicesUtil(29755):在谷歌播放均未发现服务的资源。检查项目配置,以确保资源被包括在内。
03-13 16:49:41.635:E / GooglePlayServicesUtil(29755):在谷歌播放均未发现服务的资源。检查项目配置,以确保资源被包括在内。
03-13 16:49:41.645:E / GooglePlayServicesUtil(29755):在谷歌播放均未发现服务的资源。检查项目配置,以确保资源被包括在内。
03-13 16:49:41.645:E / GooglePlayServicesUtil(29755):在谷歌播放均未发现服务的资源。检查项目配置,以确保资源被包括在内。
03-13 16:49:42.365:I /广告(29755):广告加载完毕。
03-13 16:49:43.085:I /广告(29755):调度广告刷新60000毫秒从现在开始。
03-13 16:49:43.085:I /广告(29755):广告加载完毕。
 

解决方案

我有我的设备上运行我的应用程序相同的错误。看来,这个问题在使用你的应用程序到另一个设备与device.Try做

如果广告就会出现,你的code似乎是美好的。

你也可以改变这一行这样:

  AdRequest adRequest =新AdRequest.Builder()建立()。
 

请确保您有正确的谷歌播放库在您的项目

如果你做了这些: https://developers.google.com/mobile -ads-SDK /文档/ 您的应用程序的广告应该很好地工作。

I am getting this error when I try to load and InterstitialAd from google AdMob. I know that I have written the code correctly. As I followed the short tutorial on https://developers.google.com/mobile-ads-sdk/docs/admob/advanced#play

All the happens is I get and error in the Logcat. What might I be doing wrong.

Here is the code:

public class Pref extends PreferenceActivity implements
        SharedPreferences.OnSharedPreferenceChangeListener {

    /** The view to show the ad. */
      private AdView adView;

      /* Your ad unit id. Replace with your actual ad unit id. */
      private static final String AD_UNIT_ID = "MY_ID";
      private static final String inAD_UNIT_ID = "MY_ID";
      private InterstitialAd interstitial;


    @SuppressWarnings("deprecation")
    protected void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(R.layout.ad_layout);


        //addPreferencesFromResource(R.xml.preferences);
        //getPreferenceManager()
                //.setSharedPreferencesName("com.gordondev.south_korea");
        //addPreferencesFromResource(2130903040);
        //getPreferenceManager().getSharedPreferences()
            //  .registerOnSharedPreferenceChangeListener(this);

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

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

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

        // Create an ad.
        adView = new AdView(this);
        adView.setAdSize(AdSize.BANNER);
        adView.setAdUnitId(AD_UNIT_ID);

        // Add the AdView to the view hierarchy. The view will have no size
        // until the ad is loaded.
        LinearLayout layout = (LinearLayout) findViewById(R.id.adview);
        layout.addView(adView);

        //((LinearLayout)view).addView(adView);

        // Create an ad request. Check logcat output for the hashed device ID to
        // get test ads on a physical device.
        AdRequest adRequest1 = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("INSERT_YOUR_HASHED_DEVICE_ID_HERE")
            .build();

        // Start loading the ad in the background.
        adView.loadAd(adRequest1);


    }

    // Invoke displayInterstitial() when you are ready to display an interstitial.
      public void displayInterstitial() {
        if (interstitial.isLoaded()) {
          interstitial.show();
        }
      }

Here is the Logcat error:

03-13 16:49:41.565: I/Ads(29755): Use AdRequest.Builder.addTestDevice("099098AA8954CC0C01AD412143D81BDD") to get test ads on this device.
03-13 16:49:41.565: I/Ads(29755): Starting ad request.
03-13 16:49:41.575: E/GooglePlayServicesUtil(29755): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
03-13 16:49:41.575: I/Ads(29755): Use AdRequest.Builder.addTestDevice("099098AA8954CC0C01AD412143D81BDD") to get test ads on this device.
03-13 16:49:41.575: I/Ads(29755): Starting ad request.
03-13 16:49:41.585: E/GooglePlayServicesUtil(29755): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
03-13 16:49:41.625: E/GooglePlayServicesUtil(29755): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
03-13 16:49:41.635: E/GooglePlayServicesUtil(29755): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
03-13 16:49:41.645: E/GooglePlayServicesUtil(29755): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
03-13 16:49:41.645: E/GooglePlayServicesUtil(29755): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
03-13 16:49:42.365: I/Ads(29755): Ad finished loading.
03-13 16:49:43.085: I/Ads(29755): Scheduling ad refresh 60000 milliseconds from now.
03-13 16:49:43.085: I/Ads(29755): Ad finished loading.

解决方案

I have the same error running my apps on my device. It seems that the problem have to do with your device.Try using your app to another device

If the ads will appear, your code seems to be fine.

Also you can change this line to this:

AdRequest adRequest = new AdRequest.Builder().build();

Make sure that you have the correct google play libraries in your project

If you have done these : https://developers.google.com/mobile-ads-sdk/docs/ Your app ads should work perfectly