2016-04-25 6 views
0

私はadMobライブラリをAndroid用に使用しています。時には下のスクリーンショットのように空白のページを取得します。誰が問題であるのか、そしてなぜそれが起こるのか説明することはできますか?AdMobは動作していますが、空白のページが表示されています

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:ads="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <RelativeLayout 
     android:id="@+id/adMobView" 
     android:layout_width="150dp" 
     android:layout_height="50dp" 
     android:layout_alignParentBottom="true"/> 

    <com.google.android.gms.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     ads:adSize="BANNER" 
     android:gravity="center_horizontal" 
     android:visibility="visible" 
     android:layout_marginTop="8dp" 
     ads:adUnitId="@string/banner_ad_unit_id"/> 

</RelativeLayout> 

ここは私のコードです。

public void addIntegration(Context context, LinearLayout edtView) { 
    LinearLayout mRlAddView = new LinearLayout(context); 
     mRlAddView.setOrientation(LinearLayout.VERTICAL); 
     mRlAddView.setLayoutParams(new ViewGroup.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT)); 
     mRlAddView = edtView; 
     AdView mAdView = new AdView(context); 
     mAdView.setAdSize(AdSize.BANNER); 
     mRlAddView.setGravity(Gravity.BOTTOM); 
     mAdView.setAdUnitId(context.getResources().getString(R.string.banner_ad_unit_id)); 
     mRlAddView.addView(mAdView); 
     AdRequest adRequest = new AdRequest.Builder().addTestDevice("xxxxxxxxxxxxxxxxxxxxxxxx").build(); 
     mAdView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); 
     mAdView.loadAd(adRequest); 
    } 

この問題の解決方法を教えてください。

ありがとうございました。 enter image description here

+0

あなたのlogcatエラーを入れてください... – sushildlh

+0

私たちはエラーがありません。上記の画像のみが表示されます – sasikumar

+0

"Android Monitor"で "NO FILTER"を最初に選択し、2番目のドロップダウンで "ERROR"を選択して再度実行すると、エラーが発生します。 – sushildlh

答えて

0

実際に広告が読み込まれていない可能性はありますか?あなたが実際に何が起こっているのは良いアイデアを得ることができ、リスナーの呼び出しを使用してhttps://developers.google.com/admob/android/banner#ad_lifecycle_event_callbacks

あなたのクエリと広告のライフサイクルイベントをログに記録できるよう、あなたのAdView sの広告イベントのリスナーを追加することをお勧めします

public abstract class AdListener { 
    public void onAdLoaded(); 
    public void onAdFailedToLoad(int errorCode); 
    public void onAdOpened(); 
    public void onAdClosed(); 
    public void onAdLeftApplication(); 
} 
関連する問題