2014-04-29 6 views
0


Mon annonce ne parvient pas à charger dans mon annonce et je ne sais pas pourquoi. Je serais reconnaissant si quelqu'un pouvait résoudre mon problème.Android Annonce Google Services Impossible de charger

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 capture d'écran: http://puu.sh/8sxZN.png

Pièces Manifest:

 <meta-data android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version"/> 

ET

<activity android:name="com.google.android.gms.ads.AdActivity" 
     android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 

Tout sur Créer:

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(); 
    } 
} 

mise en page entière:

<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> 

+0

Pouvez-vous poster votre manifeste. Où ajouter le FrameLayout? – Libin

+0

Affichez votre mise en page et l'intégralité de la méthode #onCreate. – William

Répondre

0

1 vous devez ajouter une référence à votre demande google play-services_lib projet

2 manifestez vous devez ajouter cette (en étiquette d'application):

<meta-data 
    android:name="com.google.android.gms.version" 
    android:value="@integer/google_play_services_version" /> 

3 votre appareil doit avoir gapps installé

0

En plus de ce que @Zakari a suggéré, assurez-vous que la case à cocher suivante est décochée.

Settings->Data Usage->Google Service->Restrict Background Data 
Questions connexes