我的logcat在向我的项目中添加admob时显示此类错误.我尝试手动添加sdk jar文件,但仍然无法正常工作.我的libs文件夹由jars-Google-play-services和
android-support-v4.i曾提及其他帖子,但发生了相同的错误,但对我没有任何帮助.
日志猫
07-02 00:26:42.082: E/AndroIDRuntime(26811): FATAL EXCEPTION: main07-02 00:26:42.082: E/AndroIDRuntime(26811): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.xmlpullparserproject/com.example.xmlpullparserproject.MainActivity}: androID.vIEw.InflateException: Binary XML file line #6: Error inflating class com.Google.ads.AdVIEw07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2184)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.app.ActivityThread.access0(ActivityThread.java:149)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.os.Handler.dispatchMessage(Handler.java:99)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.os.Looper.loop(Looper.java:153)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.app.ActivityThread.main(ActivityThread.java:5086)07-02 00:26:42.082: E/AndroIDRuntime(26811): at java.lang.reflect.Method.invokeNative(Native Method)07-02 00:26:42.082: E/AndroIDRuntime(26811): at java.lang.reflect.Method.invoke(Method.java:511)07-02 00:26:42.082: E/AndroIDRuntime(26811): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)07-02 00:26:42.082: E/AndroIDRuntime(26811): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:584)07-02 00:26:42.082: E/AndroIDRuntime(26811): at 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.AdVIEw07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:698)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.vIEw.LayoutInflater.rInflate(LayoutInflater.java:746)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:489)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:396)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:352)07-02 00:26:42.082: E/AndroIDRuntime(26811): at com.androID.internal.policy.impl.PhoneWindow.setContentVIEw(PhoneWindow.java:258)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.app.Activity.setContentVIEw(Activity.java:1867)07-02 00:26:42.082: E/AndroIDRuntime(26811): at com.example.xmlpullparserproject.MainActivity.onCreate(MainActivity.java:31)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.app.Activity.performCreate(Activity.java:5020)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2148)07-02 00:26:42.082: E/AndroIDRuntime(26811): ... 11 more07-02 00:26:42.082: E/AndroIDRuntime(26811): Caused by: java.lang.classNotFoundException: com.Google.ads.AdVIEw07-02 00:26:42.082: E/AndroIDRuntime(26811): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)07-02 00:26:42.082: E/AndroIDRuntime(26811): at java.lang.classLoader.loadClass(ClassLoader.java:501)07-02 00:26:42.082: E/AndroIDRuntime(26811): at java.lang.classLoader.loadClass(ClassLoader.java:461)07-02 00:26:42.082: E/AndroIDRuntime(26811): at androID.vIEw.LayoutInflater.createVIEw(LayoutInflater.java:552)07-02 00:26:42.082: E/AndroIDRuntime(26811): at 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>
主活动
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);
解决方法:
广告xml名称空间有误:
在GoogleAdMobAdsSdk-6.4.1.jar或更早版本中,您可以使用:
<com.Google.ads.AdVIEw
与名称空间:
xmlns:ads= "http://schemas.androID.com/apk/lib/com.Google.ads"
在通过播放服务库的Google admob中,您可以使用:
<com.Google.androID.gms.ads.AdVIEw
与名称空间:
xmlns:ads="http://schemas.androID.com/apk/res-auto
总结 以上是内存溢出为你收集整理的android-二进制XML文件第6行:膨胀类com.google.ads.AdView时出错全部内容,希望文章能够帮你解决android-二进制XML文件第6行:膨胀类com.google.ads.AdView时出错所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)