XML : Inflating class com.google.android.gms.ads.Adview Error in Eclipse

I want to add an ad my to application. So I've read intructions from

https://developers.google.com/admob/android/eclipse? hl=tr

and I applied all steps but when I run my application I'm getting : android.View.InflateException : Binary Xml file line xx Error Inflating class com.google.android.gms.ads.Adview
I don't know what I must do

Activity_main.xml

  <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"  android:orientation="vertical"  tools:context=".MainActivity">    <android.support.v7.widget.Toolbar    android:id="@+id/toolbar"    android:layout_height="wrap_content"    android:layout_width="match_parent"    android:background="@color/ColorPrimary"    android:elevation="4dp"    android:theme="@style/Base.ThemeOverlay.AppCompat.Dark"    xmlns:android="http://schemas.android.com/apk/res/android" />       <android.support.v4.view.ViewPager      android:id="@+id/pager"        android:layout_height="match_parent"      android:layout_width="match_parent"      android:layout_weight="1"      ></android.support.v4.view.ViewPager>     <com.google.android.gms.ads.AdView      android:id="@+id/adView"      android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:layout_centerHorizontal="true"      android:layout_alignParentBottom="true"      ads:adSize="BANNER"      ads:adUnitId="@string/banner_ad_unit_id">  </com.google.android.gms.ads.AdView>    

Manifest file :

     <?xml version="1.0" encoding="utf-8"?>     <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.proje.exa"     android:versionCode="1"      android:versionName="1.0" >       <uses-sdk      android:minSdkVersion="15"      android:targetSdkVersion="23" />    <uses-permission android:name="android.permission.INTERNET" />   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>  <uses-permission android:name="android.permission.VIBRATE" />  <uses-permission android:name="android.permission.WAKE_LOCK"/>      <application      android:allowBackup="true"      android:icon="@drawable/app_icon2"      android:label="@string/app_name"      android:theme="@style/Theme.AppCompat.Light.NoActionBar">          <meta-data android:name="com.google.android.gms.version"      android:value="@integer/google_play_services_version" />        <provider       android:name=".ContentProvider"      android:authorities="com.proje.exa.ContentProvider"></provider>       <activity          android:name="com.proje.exa.MainActivity"          android:label="@string/app_name" >          <intent-filter>              <action android:name="android.intent.action.DEFAULT" />              <category android:name="android.intent.category.LAUNCHER" />          </intent-filter>      </activity>        <activity android:name="com.google.android.gms.ads.AdActivity"             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|s        creenSize|smallestScreenSize"          android:theme="@android:style/Theme.Translucent" />    </application>      </manifest>    

In Mainactivity.java

  import com.google.android.gms.ads.AdRequest;  import com.google.android.gms.ads.AdView;      public class MainActivity extends AppCompatActivity{    ......  ......        AdView mAdView = (AdView) findViewById(R.id.adView);      AdRequest adRequest = new AdRequest.Builder().build();      mAdView.loadAd(adRequest);       }    

I included this lines but I'm getting error when I run the app

enter image description here

I don't know What's wrong, thanks for help..

No comments:

Post a Comment