RelativeLayout layout = new RelativeLayout(this);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
View gameView = initializeForView(new MainGame(), config);
layout.addView(gameView);
adView = new AdView(this);
adView.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
System.out.println("LOAD");
}
});
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId("ca-app-xxx-xxxxxxxxxx/xxxxxxxxxx");
AdRequest.Builder builder = new AdRequest.Builder();
RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT
);
layout.addView(adView, adParams);
adView.loadAd(builder.build());
setContentView(layout);
没有显示,没有广告,为什么,我也加入的build.gradle(项目:projectN)编译“com.google.android.gms:发挥服务的广告:$ admobVersion”
使用Ubuntu 16.04,机器人工作室