Once in a while Out of many users of my app on a market (same version -same APK) I get error like this... I guess main thing here is: Caused by: java.io.FileNotFoundException: res/drawable/ic_new.png
This file definitely there and it works on other devices. I get this error once in a while on other devices with random files.. How is that possible?
android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at com.activities.MailListActivity$MailListCursorAdapter.getView(MailListActivity.java:171)
at android.widget.AbsListView.obtainView(AbsListView.java:1560)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1289)
at android.widget.ListView.onMeasure(ListView.java:1200)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.view.ViewRoot.performTraversals(ViewRoot.java:844)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at android.view.LayoutInflater.createView(LayoutInflater.java:505)
... 37 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_new.png from drawable resource ID #0x7f02001c
at android.content.res.Resources.loadDrawable(Resources.java:1714)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.ImageView.<init>(ImageView.java:118)
at android.widget.ImageView.<init>(ImageView.java:108)
... 40 more
Caused by: java.io.FileNotFoundException: res/drawable/ic_new.png
at android.content.res.AssetManager.openNonAssetNative(Native Method)
at android.content.res.AssetManager.openNonAsset(AssetManager.java:406)
at android.content.res.Resources.loadDrawable(Resources.java:1706)
... 43 more
You have not specifically mentioned the way you organize the images in your application. However there are the specific folders drawable-ldpi, 'drawable-mdpi', 'drawable-hdpi' and even 'drawable-xhdpi' together with the basic 'drawable' folder.
Maybe you are familiar with all those, but I will repeat their usage patterns, because I have a feeling this might be failing you. The ldpi, mdpi, hdpi and xhdpi mean low, medium, high and extra high dpi - different screen resolutions. Android has a special way of determining the hardware characteristics of the device you are running on and thus mapping it to the most relevant: ldpi, mdpi, hdpi or xhdpi.
When it comes to a place in which you need an image say image.png it first searches for drawable-mdpi/image.png (if it has determined your device to be mapping to mdpi). If such image is not found it goes and tries drawable/image.png and will rescale it if found. And that's it, if those two searches have failed and you have supplied the image in some of the other resolutions' folder it will not use it. This means that if you install the app on xhdpi device and have supplied only ldpi and mdpi image on such device no relevant image will be found.
So my suggestion is that you have some of your images in just some of the formats. This is the best I can do without further information. Hopefully I got it correctly and I will be of help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With