嗨我能夠添加谷歌adMob橫幅,它顯示元數據的錯誤消息,當我自己運行應用程序時,但一旦我設法解決這些問題,它不會顯示谷歌廣告。它顯示橫幅,但它是空的。谷歌廣告顯示空白,你有什麼建議?
我設置了它,使adView與背景有不同的佈局,並且它顯示何時點擊屏幕。問題在於,當你點擊屏幕時,它會顯示橫幅較暗的區域,其中顯示橫幅錯誤(我認爲這是GoogleAd橫幅),但顯示爲空。所以只有它的區域變暗,但什麼也沒有顯示。
這裏是我的MigratorisActivity.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.migratoris_activity);
final View controlsView = findViewById(R.id.fullscreen_content_controls);
final View contentView = findViewById(R.id.GIFSingle);
// Create the adView.
adView = new AdView(this);
adView.setAdUnitId("a--------------");
adView.setAdSize(AdSize.BANNER);
// Lookup your LinearLayout assuming it's been given
// the attribute android:id="@+id/mainLayout".
LinearLayout layout = (LinearLayout) findViewById(R.id.fullscreen_content_controls);
// Add the adView to it.
layout.addView(adView);
// Initiate a generic request.
AdRequest adRequest = new AdRequest.Builder().build();
// Load the adView with the ad request.
adView.loadAd(adRequest);
這是我的清單:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<activity
android:name="pt.quintas.migratoris.MigratorisActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>
任何人有一個想法,爲什麼它,但沒有顯示廣告?是否可以將AdMob帳戶設置爲測試模式?
非常感謝您的寶貴時間, 佩德羅
這裏是佈局
<FrameLayout
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:background="#000000"
android:id="@+id/MainLayout"
tools:context=".MigratorisActivity" >
<!--
The primary full-screen view. This can be replaced with whatever view
is needed to present your content, e.g. VideoView, SurfaceView,
TextureView, etc.
-->
<pt.quintas.migratoris.GIFView
android:layout_marginLeft="0dp"
android:layout_gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/GIFSingle">
</pt.quintas.migratoris.GIFView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_gravity="center_horizontal|top"
android:textStyle="bold"
android:textSize="10pt"
android:padding="16dip"
android:textColor="#ffffffff"
android:text="You have migrated for:" />
<TextView
android:id="@+id/textCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_gravity="center_horizontal|bottom"
android:textStyle="bold"
android:textSize="10pt"
android:padding="16dip"
android:textColor="#ffffffff"
android:text="" />
<!--
This FrameLayout insets its children based on system windows using
android:fitsSystemWindows.
-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" >
<LinearLayout
android:id="@+id/fullscreen_content_controls"
style="?buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/black_overlay"
android:orientation="horizontal"
tools:ignore="UselessParent" >
</LinearLayout>
</FrameLayout>
</FrameLayout>
我曾試圖彌補在MainLayout的附加工作,它的工作,我相信這個問題被誇大它隨着佈局,它需要更多的空間。 這裏是LOGG:
01-15 16:50:53.552: I/ApplicationPackageManager(11135): cscCountry is not German : VOD
01-15 16:50:54.002: I/Ads(11135): Use AdRequest.Builder.addTestDevice("B246DEAA33A5FAE6AF9FF0A2F44B5CBC") to get test ads on this device.
01-15 16:50:54.002: I/Ads(11135): Starting ad request.
01-15 16:50:54.002: I/webclipboard(11135): clipservice: [email protected]
01-15 16:50:54.012: W/Ads(11135): Not enough space to show ad. Needs 480x75, but only has 474x754
01-15 16:50:54.022: W/Ads(11135): Not enough space to show ad. Needs 480x75, but only has 474x792
01-15 16:50:54.032: W/Ads(11135): Not enough space to show ad. Needs 480x75, but only has 474x792
01-15 16:50:54.052: E/GooglePlayServicesUtil(11135): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
01-15 16:50:54.182: E/GooglePlayServicesUtil(11135): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
01-15 16:50:54.223: E/(11135): Wink AGIF Error 7 700 100 7
01-15 16:50:54.273: E/GooglePlayServicesUtil(11135): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
01-15 16:50:54.443: E/(11135): Wink AGIF Error 7 700 100 7
01-15 16:50:54.663: E/(11135): Wink AGIF Error 7 700 100 7
01-15 16:50:54.893: E/(11135): Wink AGIF Error 7 700 100 7
01-15 16:50:55.183: E/(11135): Wink AGIF Error 7 700 100 7
01-15 16:50:55.384: E/(11135): Wink AGIF Error 7 700 100 7
01-15 16:50:55.584: E/(11135): Wink AGIF Error 7 700 100 7
01-15 16:50:55.804: E/(11135): Wink AGIF Error 7 700 100 7
01-15 16:50:56.134: E/(11135): Wink AGIF Error 7 700 100 7
01-15 16:50:56.224: I/Ads(11135): Ad finished loading.
發佈您的日誌。發佈您的佈局。 – William