Reputation: 49
I encounter an error while putting the ad banner like the one below The Error Here
Sorry, it says you need 10 or more reputation to post a picture.
My XML code for ads just like below
<com.google.android.gms.ads.AdView
android:id="@+id/adView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
it is said that I must put code:
ads:adSize
in there, but every time I put ads:adSize
it turns into red and becoming an
error: Attribute Unknown.
do I miss something about in installation?
What could I do so that error won't happen?
Upvotes: 0
Views: 81
Reputation: 867
You need an attribute like ads:adSize="BANNER"
You can add in your code using this:
final AdView adView = new AdView(getActivity());
adView.setAdUnitId("YourId");
adView.setAdSize(AdSize.BANNER);
Upvotes: 1