【问题标题】:fatal runtime exception binary xml file reference?致命的运行时异常二进制 xml 文件参考?
【发布时间】:2012-12-19 22:01:58
【问题描述】:

我得到以下致命的运行时异常(android 2.1):

12-19 21:23:53.160:E/AndroidRuntime(279):致命异常:主要 12-19 21:23:53.160: E/AndroidRuntime(279): android.view.InflateException: Binary XML file line #24: Error inflating class com.michaelnovakjr.numberpicker.NumberPicker

在将名称空间从 com.michaelnovakjr 更改为另一个名称之后。

我在整个源代码中找不到任何对 com.michaelnovakjr 的引用。

谁能告诉我在哪里看?

我已经清理了项目,重启了 Eclipse,创建了新的虚拟 Android 设备,以防万一留下任何东西/没有正确重建。

整个工作区由一个项目和一个库组成,现在都在命名空间 nl.computerhuys.TabNavUI 中。由于致命异常提到“main”,我假设错误出现在 main.xml 中,其中有两个:一个在库中:

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

和项目中的一个:

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

logcat 错误消息中的第 24 行显然没有引用这些文件中的任何一个。那么如何找出它所引用的 .xml 文件呢?

【问题讨论】:

    标签: inflate-exception


    【解决方案1】:

    刚刚找到。

    实际上在库的 dialog_number_picker.xml 中还有对旧命名空间的引用。通过查找项目中的所有 .xml 文件(windows 搜索)找到它,在 notepad++ 中打开所有文件,然后在所有打开的文件中进行字符串搜索...

    现在工作正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-05
      相关资源
      最近更新 更多