在 android 2.0 中膨胀 android.widget.ImageView 时出错

发布于 2024-11-08 00:46:09 字数 4671 浏览 0 评论 0原文

这是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰魂雪魄 2024-11-15 00:46:09
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi/title_bar_shadow.9.png

确保每个文件夹 res/drawable-mdpi/res/drawable-ldpi/ 中都有一个文件 title_bar_shadow.9.pngres/drawable-hdpi/。似乎 -mdpi 中缺少这一点。

Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi/title_bar_shadow.9.png

Make sure you have a file title_bar_shadow.9.png in each of your folders res/drawable-mdpi/, res/drawable-ldpi/ and res/drawable-hdpi/. It seems that is missing from the -mdpi one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文