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