I've been encountering and InflateException
error and am not really sure what it means. I hope someone can explain it to me. Thanks. Below is the stack trace.
09-26 17:35:29.747: ERROR/AndroidRuntime(10214): Uncaught handler: thread main exiting due to uncaught exception
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.comp.something/com.project.something.something.android.SomethingActivity}: android.view.InflateException: Binary XML file line #15: Error inflating class com.project.something.something.android
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.os.Handler.dispatchMessage(Handler.java:99)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.os.Looper.loop(Looper.java:123)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.app.ActivityThread.main(ActivityThread.java:4363)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at java.lang.reflect.Method.invokeNative(Native Method)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at java.lang.reflect.Method.invoke(Method.java:521)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteIn开发者_运维技巧it.java:862)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at dalvik.system.NativeStart.main(Native Method)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class com.project.something.something.android
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.app.Activity.setContentView(Activity.java:1631)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at com.project.something.something.android.SomethingActivity.onCreate(SomethingActivity.java:48)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): ... 11 more
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): Caused by: java.lang.ClassNotFoundException:com.project.something.something.android in loader dalvik.system.PathClassLoader@4803c918
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
09-26 17:35:30.072: ERROR/AndroidRuntime(10214): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
It seems you want to set a layout in your onCreate()
method using setContentView()
. The layout refers to a class in line #5 that is named com.project.something.something.android
. I guess the class doesn't exist and so the layout couldn't be inflated.
精彩评论