0
我的广告无法加载我的加入内容,我不确定这是为什么。如果有人能解决我的问题,我将不胜感激。Android Google服务广告未能加载
adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(AD_UNIT_ID);
FrameLayout layout = new FrameLayout(this);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build();
adView.loadAd(adRequest);
layout.addView(adView);
logcat的截图: http://puu.sh/8sxZN.png
舱单件:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
和
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
整个上创建:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
a = getSharedPreferences("userdata",0);
b = a.edit();
setContentView(R.layout.activity_main);
adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(AD_UNIT_ID);
FrameLayout layout = new FrameLayout(this);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("065294C80051124D2AB59139999F3202")
.build();
adView.loadAd(adRequest);
layout.addView(adView);
auth = new Authenticate(b, a, d);
if (auth.auth){
Intent intent = new Intent(this, DisplayMessageActivity.class);
startActivity(intent);
}else{
newFragment = new login();
newFragment.show(getFragmentManager(), "missiles");
}
localData= new LocalDataInterface(b,c);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
}
整个布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical">
</LinearLayout>
你可以发布你的清单。另外你在哪里添加FrameLayout? – Libin
发布您的布局和整个#onCreate方法。 – William