How to add ad in app?

0

I'm using this code:

<com.google.android.gms.ads.AdView android:id="@+id/adView"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  ads:adUnitId="MY_AD_UNIT_ID"
  ads:adSize="BANNER"/>

Initialization:

// Consultar o AdView como um recurso e carregar uma solicitação.
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest); 

But it goes wrong:

  

Description Resource Path Location Type error: No resource identifier found for attribute 'loadAdOnCreate' in package 'com.teste.teste1' activity_teste.xml / Test / res / layout line 120 Android AAPT Problem

This error has already been fixed, my code is the same as mentioned in Graphical Layout where the BANNER is written in red

  

XML Required attribute "adSize" was missing

    
asked by anonymous 05.02.2015 / 22:40

1 answer

0

Just remove the lines android:padding....... it worked right.

    
10.02.2015 / 01:10