android - Binary XML file line #6: Error inflating class com.google.ads.AdView -


my logcat showing such error on adding admob project.i have tried manually adding sdk jar file still doesn't work.my libs folder consist of jars-google-play-services , android-support-v4.i have referred other posts same error nothing works me.

logcat

07-02 00:26:42.082: e/androidruntime(26811): fatal exception: main 07-02 00:26:42.082: e/androidruntime(26811): java.lang.runtimeexception: unable start activity componentinfo{com.example.xmlpullparserproject/com.example.xmlpullparserproject.mainactivity}: android.view.inflateexception: binary xml file line #6: error inflating class com.google.ads.adview 07-02 00:26:42.082: e/androidruntime(26811):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2184) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.app.activitythread.handlelaunchactivity(activitythread.java:2211) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.app.activitythread.access$600(activitythread.java:149) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.app.activitythread$h.handlemessage(activitythread.java:1300) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.os.handler.dispatchmessage(handler.java:99) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.os.looper.loop(looper.java:153) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.app.activitythread.main(activitythread.java:5086) 07-02 00:26:42.082: e/androidruntime(26811):    @ java.lang.reflect.method.invokenative(native method) 07-02 00:26:42.082: e/androidruntime(26811):    @ java.lang.reflect.method.invoke(method.java:511) 07-02 00:26:42.082: e/androidruntime(26811):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:821) 07-02 00:26:42.082: e/androidruntime(26811):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:584) 07-02 00:26:42.082: e/androidruntime(26811):    @ dalvik.system.nativestart.main(native method) 07-02 00:26:42.082: e/androidruntime(26811): caused by: android.view.inflateexception: binary xml file line #6: error inflating class com.google.ads.adview 07-02 00:26:42.082: e/androidruntime(26811):    @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:698) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.view.layoutinflater.rinflate(layoutinflater.java:746) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.view.layoutinflater.inflate(layoutinflater.java:489) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.view.layoutinflater.inflate(layoutinflater.java:396) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.view.layoutinflater.inflate(layoutinflater.java:352) 07-02 00:26:42.082: e/androidruntime(26811):    @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:258) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.app.activity.setcontentview(activity.java:1867) 07-02 00:26:42.082: e/androidruntime(26811):    @ com.example.xmlpullparserproject.mainactivity.oncreate(mainactivity.java:31) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.app.activity.performcreate(activity.java:5020) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1080) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2148) 07-02 00:26:42.082: e/androidruntime(26811):    ... 11 more 07-02 00:26:42.082: e/androidruntime(26811): caused by: java.lang.classnotfoundexception: com.google.ads.adview 07-02 00:26:42.082: e/androidruntime(26811):    @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:61) 07-02 00:26:42.082: e/androidruntime(26811):    @ java.lang.classloader.loadclass(classloader.java:501) 07-02 00:26:42.082: e/androidruntime(26811):    @ java.lang.classloader.loadclass(classloader.java:461) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.view.layoutinflater.createview(layoutinflater.java:552) 07-02 00:26:42.082: e/androidruntime(26811):    @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:687) 07-02 00:26:42.082: e/androidruntime(26811):    ... 21 more 

xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"      xmlns:ads="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent" > <com.google.ads.adview android:id="@+id/adview"                          android:layout_width="wrap_content"                          android:layout_height="wrap_content"                          ads:adunitid="xyz"                          ads:adsize="banner"                           />     <listview         android:id="@+id/lv_countries"         android:layout_width="wrap_content"         android:layout_height="wrap_content"                 tools:context=".mainactivity" />  </relativelayout> 

mainactvity

setcontentview(r.layout.activity_main);          adview adview = (adview)this.findviewbyid(r.id.adview);          adrequest adrequest = new adrequest.builder()         .addtestdevice(adrequest.device_id_emulator)       //          .addtestdevice("3a2d1115ab64e3") //           .build() ;         adview.loadad(adrequest); 

the ad xml namespace wrong:

in googleadmobadssdk-6.4.1.jar or earlier use:

<com.google.ads.adview  

with namespace:

 xmlns:ads= "http://schemas.android.com/apk/lib/com.google.ads" 

in google admob via play service library, use:

<com.google.android.gms.ads.adview 

with namespace:

 xmlns:ads="http://schemas.android.com/apk/res-auto 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -