我已完成Google Play服务迁移教程https://developers.google.com/mobile-ads-sdk/docs/admob/play-migration
一切都很好,但是当我创建Adview时,它就完成了。
这是我的代码:
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
private AdView adView;
RelativeLayout layoutPublicidadHueco;
.
.
.
layoutPublicidadHueco = (RelativeLayout) findViewById(R.id.layoutAdver);
AdView adView = new AdView(this);
adView.setAdUnitId("my number");
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdListener(new AdListener() {
public void onAdLoaded() {}
public void onAdFailedToLoad(int errorcode) {}
// Only implement methods you need.
});
layoutPublicidadHueco.removeAllViews();
layoutPublicidadHueco.addView(adView);
layoutPublicidadHueco.setVisibility(View.VISIBLE);
AdRequest request = new AdRequest.Builder().build();
adView.loadAd(request);
提前致谢。
答案 0 :(得分:2)
我解决了这个问题,我在图书馆中添加了Google Play服务,并在外部jar中添加了Google Play服务,并将其导出。
由于