I’ve been getting occasional exception reports from my users when inflating a layout:
android.view.InflateException: Binary XML file line #2: Error inflating class com.MyClass
It happens rarely and I’ve never seen it myself… until now. Suddenly I get that exception every time, using the exact same layout that I’ve been using all along:
<?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" >
<com.comet.android.keyboard.CandidateView
android:id="@+id/candidate"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</com.comet.android.keyboard.CandidateView>
<include layout="@layout/keyboard_view" />
</LinearLayout>
In addiation, Eclipse has always reported this warning on line #1:
No grammar constraints (DTD or XML schema) detected for the document.
Any ideas on why I would get a warning on line #1 and an exception on line #2? Are the two related? This file worked until today and I didn’t change it!
I’ve noticed that the namespace URL http://schemas.android.com/apk/res/android doesn’t resolve. Could that be it? It is the same URL used in all the Android examples.
The warning is harmless. If you want to get rid of it look here http://code.google.com/p/android/issues/detail?id=9831
The error is strange… could you post the code you use to inflate the layout? Also do you have a class called
com.MyClass?