在 android 2.0 中膨胀 android.widget.ImageView 时出错
这是 Imageview 的堆栈跟踪。未找到图标资源也会生成类似的错误。当我尝试在 android 2.0 中执行应用程序时发生这种情况,但它在版本 > 上运行良好。 2.0。我不知道是什么问题。另外,我的 xml 是一个闪屏图像。就是这样。有人可以帮我解决这个问题吗?谢谢!!
W/dalvikvm( 233): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
E/AndroidRuntime( 233): Uncaught handler: thread main exiting due to uncaught exception
**E/AndroidRuntime( 233): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.medical.ReadingHealth/com.medical.ReadingHea
lth.SplashScreen}: android.view.InflateException: Binary XML file line #7: Error inflating class** android.widget.ImageView
E/AndroidRuntime( 233): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2454)
E/AndroidRuntime( 233): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470)
E/AndroidRuntime( 233): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime( 233): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
E/AndroidRuntime( 233): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 233): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 233): at android.app.ActivityThread.main(ActivityThread.java:4310)
E/AndroidRuntime( 233): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 233): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 233): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 233): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 233): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 233): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class android.widget.ImageView
E/AndroidRuntime( 233): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
E/AndroidRuntime( 233): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 233): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
E/AndroidRuntime( 233): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
E/AndroidRuntime( 233): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
E/AndroidRuntime( 233): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
E/AndroidRuntime( 233): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime( 233): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
E/AndroidRuntime( 233): at android.app.Activity.setContentView(Activity.java:1622)
E/AndroidRuntime( 233): at com.medical.ReadingHealth.SplashScreen.onCreate(SplashScreen.java:14)
E/AndroidRuntime( 233): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 233): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime( 233): ... 11 more
E/AndroidRuntime( 233): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 233): at android.widget.ImageView.<init>(ImageView.java:105)
E/AndroidRuntime( 233): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 233): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
E/AndroidRuntime( 233): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
E/AndroidRuntime( 233): ... 22 more
E/AndroidRuntime( 233): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi/title_bar_shadow.9.png from draw
able resource ID #0x7f020032
E/AndroidRuntime( 233): at android.content.res.Resources.loadDrawable(Resources.java:1710)
E/AndroidRuntime( 233): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
E/AndroidRuntime( 233): at android.widget.ImageView.<init>(ImageView.java:115)
E/AndroidRuntime( 233): ... 26 more
E/AndroidRuntime( 233): Caused by: java.io.FileNotFoundException: res/drawable-mdpi/title_bar_shadow.9.png
E/AndroidRuntime( 233): at android.content.res.AssetManager.openNonAssetNative(Native Method)
E/AndroidRuntime( 233): at android.content.res.AssetManager.openNonAsset(AssetManager.java:391)
E/AndroidRuntime( 233): at android.content.res.Resources.loadDrawable(Resources.java:1702)
E/AndroidRuntime( 233): ... 28 more
This is the stack trace for Imageview. Similar error is generated for icon Resource not found. This happened when i was trying to execute app in android 2.0 but it runs fine for versions > 2.0. I dont know what is the problem. Also, my xml is a splashscreen image. Thats it. Can somebody please help me with this? Thanks!!
W/dalvikvm( 233): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
E/AndroidRuntime( 233): Uncaught handler: thread main exiting due to uncaught exception
**E/AndroidRuntime( 233): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.medical.ReadingHealth/com.medical.ReadingHea
lth.SplashScreen}: android.view.InflateException: Binary XML file line #7: Error inflating class** android.widget.ImageView
E/AndroidRuntime( 233): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2454)
E/AndroidRuntime( 233): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470)
E/AndroidRuntime( 233): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime( 233): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
E/AndroidRuntime( 233): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 233): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 233): at android.app.ActivityThread.main(ActivityThread.java:4310)
E/AndroidRuntime( 233): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 233): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 233): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 233): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 233): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 233): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class android.widget.ImageView
E/AndroidRuntime( 233): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
E/AndroidRuntime( 233): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 233): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
E/AndroidRuntime( 233): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
E/AndroidRuntime( 233): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
E/AndroidRuntime( 233): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
E/AndroidRuntime( 233): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime( 233): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
E/AndroidRuntime( 233): at android.app.Activity.setContentView(Activity.java:1622)
E/AndroidRuntime( 233): at com.medical.ReadingHealth.SplashScreen.onCreate(SplashScreen.java:14)
E/AndroidRuntime( 233): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 233): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime( 233): ... 11 more
E/AndroidRuntime( 233): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 233): at android.widget.ImageView.<init>(ImageView.java:105)
E/AndroidRuntime( 233): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 233): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
E/AndroidRuntime( 233): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
E/AndroidRuntime( 233): ... 22 more
E/AndroidRuntime( 233): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi/title_bar_shadow.9.png from draw
able resource ID #0x7f020032
E/AndroidRuntime( 233): at android.content.res.Resources.loadDrawable(Resources.java:1710)
E/AndroidRuntime( 233): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
E/AndroidRuntime( 233): at android.widget.ImageView.<init>(ImageView.java:115)
E/AndroidRuntime( 233): ... 26 more
E/AndroidRuntime( 233): Caused by: java.io.FileNotFoundException: res/drawable-mdpi/title_bar_shadow.9.png
E/AndroidRuntime( 233): at android.content.res.AssetManager.openNonAssetNative(Native Method)
E/AndroidRuntime( 233): at android.content.res.AssetManager.openNonAsset(AssetManager.java:391)
E/AndroidRuntime( 233): at android.content.res.Resources.loadDrawable(Resources.java:1702)
E/AndroidRuntime( 233): ... 28 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保每个文件夹
res/drawable-mdpi/
、res/drawable-ldpi/
中都有一个文件title_bar_shadow.9.png
和res/drawable-hdpi/
。似乎 -mdpi 中缺少这一点。Make sure you have a file
title_bar_shadow.9.png
in each of your foldersres/drawable-mdpi/
,res/drawable-ldpi/
andres/drawable-hdpi/
. It seems that is missing from the -mdpi one.