运行应用程序时android.view.Space的ClassNotFoundException [英] ClassNotFoundException for android.view.Space when running application

查看:93
本文介绍了运行应用程序时android.view.Space的ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当活动布局中存在某些元素时,我在运行应用程序时遇到问题.我具有以下布局,并且在包含"Space"元素时遇到了问题:

I'm having an issue running my application when certain elements exist in the layout of my activity. I have the following layout, and I have issue when I include the "Space" element:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical" >

<Button
       android:id="@+id/button1"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_alignParentBottom="true"
       android:layout_alignParentLeft="true"
       android:text="@string/foursquare" />

<Button
      android:id="@+id/button2"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_above="@+id/foursquare_button"
      android:layout_alignParentLeft="true"
      android:text="@string/yelp" />

<Space
    android:layout_width="match_parent"
    android:layout_height="100px"
    android:layout_weight="0.18" />
</LinearLayout>

我得到的错误是:

11-26 11:14:09.875:E/AndroidRuntime(10485):致命异常:main
...
11-26 11:14:09.875:E/AndroidRuntime(10485):java.lang.RuntimeException:无法启动活动ComponentInfo {com.infoit.nfc.activity/com.infoit.nfc.activity.ViewTag}:android.view .InflateException:二进制XML文件第23行:膨胀类空间时出错
...
11-26 11:14:09.875:E/AndroidRuntime(10485):原因:android.view.InflateException:二进制XML文件第23行:膨胀类空间错误
...
11-26 11:14:09.875:E/AndroidRuntime(10485):原因:java.lang.ClassNotFoundException:加载程序dalvik.system.PathClassLoader [/data/app/com.infoit.nfc.activity中的android.view.Space -2.apk]
...

11-26 11:14:09.875: E/AndroidRuntime(10485): FATAL EXCEPTION: main
...
11-26 11:14:09.875: E/AndroidRuntime(10485): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.infoit.nfc.activity/com.infoit.nfc.activity.ViewTag}: android.view.InflateException: Binary XML file line #23: Error inflating class Space
...
11-26 11:14:09.875: E/AndroidRuntime(10485): Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class Space
...
11-26 11:14:09.875: E/AndroidRuntime(10485): Caused by: java.lang.ClassNotFoundException: android.view.Space in loader dalvik.system.PathClassLoader[/data/app/com.infoit.nfc.activity-2.apk]
...

如果我删除了Space元素,那么一切都会变得扑朔迷离.即使我以为定义xmlns可以解决问题,但还是无法找到Space类.我觉得这很简单,但是我很想念它.

If I remove the Space element everything is peachy keen. Somehow it's not able to find the Space class even though I thought defining the xmlns would solve the issue. I feel this is something simple, but I am missing it.

推荐答案

xml文件需要引用由平台或您自己的项目定义的现有小部件,而Space不是标准的Android小部件.尝试将其替换为View.

The xml file needs to refer to existing widgets either defined by the platform or by your own project, and Space is not a standard Android widget. Try replacing it with View instead.

这篇关于运行应用程序时android.view.Space的ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆