How To Use Admob In Android Webview?
Hi all I am using admob in android webview. When i integrated admob and run, it displays following error. My code is as follows:
<com.google.ads.AdView
android:id="@+id/adViews"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="false"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-123456" >
</com.google.ads.AdView>
to:
<com.google.android.gms.ads.AdView
android:id="@+id/adViews"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="false"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-123456"/>
Solution 2:
So the Stacktrace says "Didn't find class com.google.ads.AdView"
That's because you're probably using the Admob SDK via the Google Play Services which is mandatory as of 1st of August. (Otherwise you won't be able to upload an application to the Play Store). So instead of using com.google.ads.AdView you need to use com.google.android.gms.ads.AdView.
You can read more about the Migration of the Admob SDK to the Google Play Services on the official developer site (click)
Edit: By the way, you have to move the Admob-Banner layout-code below the LinearLayout otherwise it won't be visible.
Post a Comment for "How To Use Admob In Android Webview?"