Admob不适用于较新的android版本

Admob不适用于较新的android版本,android,admob,Android,Admob,我正在尝试在我的应用程序中使用Admob,它在早期版本(如4.0和早期版本)上运行良好,但在4.1和更新版本上没有显示 adView = new AdView(this); adView.setAdSize(AdSize.BANNER); adView.setAdUnitId(AD_UNIT_ID); // Set the AdListener. adView.setAdListener(new AdListener() { /** * Called when an ad is clicked

我正在尝试在我的应用程序中使用Admob,它在早期版本(如4.0和早期版本)上运行良好,但在4.1和更新版本上没有显示

adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(AD_UNIT_ID);

// Set the AdListener.
adView.setAdListener(new AdListener() {
/**
* Called when an ad is clicked and about to return to the
* application.
*/
@Override
public void onAdClosed() {
 Log.d(LOG_TAG, "onAdClosed");
 Toast.makeText(BannerAdListener.this, "onAdClosed",
   Toast.LENGTH_SHORT).show();
  }

/** Called when an ad failed to load. */
@Override
public void onAdFailedToLoad(int error) {
String message = "onAdFailedToLoad: " + getErrorReason(error);
Log.d(LOG_TAG, message);
Toast.makeText(BannerAdListener.this, message,
  Toast.LENGTH_SHORT).show();
}

/**
* Called when an ad is clicked and going to start a new Activity
* that will leave the application (e.g. breaking out to the Browser
* or Maps application).
*/
 @Override
public void onAdLeftApplication() {
 Log.d(LOG_TAG, "onAdLeftApplication");
 Toast.makeText(BannerAdListener.this, "onAdLeftApplication",
   Toast.LENGTH_SHORT).show();
}

/**
 * Called when an Activity is created in front of the app (e.g. an
 * interstitial is shown, or an ad is clicked and launches a new
 * Activity).
 */
 @Override
 public void onAdOpened() {
 Log.d(LOG_TAG, "onAdOpened");
  Toast.makeText(BannerAdListener.this, "onAdOpened",
   Toast.LENGTH_SHORT).show();
 }

  /** Called when an ad is loaded. */
 @Override
 public void onAdLoaded() {
 Log.d(LOG_TAG, "onAdLoaded");
  Toast.makeText(BannerAdListener.this, "onAdLoaded",
  Toast.LENGTH_SHORT).show();
  }
  });
   // Add the AdView to the view hierarchy.
  LinearLayout layout = (LinearLayout) findViewById(R.id.linearLayout);
  layout.addView(adView);

您在日志中看到了什么?在这两种情况下都会出现此错误,但在广告显示的早期版本中,找不到Google Play services资源。检查您的项目配置以确保包含资源。忽略错误未找到Google Play services资源。我在我的应用程序中也有同样的错误,但我看到了广告。所以这个错误不是你的问题。那么安卓4.1.x上会有什么问题呢?嗯,你的日志smthng中是否也有msg,好像没有针对这个请求的广告?