膨胀异常
我一直遇到 InflateException
错误,但不太确定它的含义。我希望有人能给我解释一下。谢谢。下面是堆栈跟踪。
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(ZygoteInit.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)
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(ZygoteInit.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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎想使用
setContentView()
在onCreate()
方法中设置布局。布局引用第 5 行中名为 com.project.something.something.android 的类。我猜想该类不存在,因此布局无法膨胀。It seems you want to set a layout in your
onCreate()
method usingsetContentView()
. The layout refers to a class in line #5 that is namedcom.project.something.something.android
. I guess the class doesn't exist and so the layout couldn't be inflated.