libreliodev / android

Android Customizable Reader - Librelio Digital Publishing Suite
www.librelio.com
226 stars 130 forks source link

Crash report : Error inflating class android.widget.ImageView #239

Closed libreliodev closed 10 years ago

libreliodev commented 10 years ago

https://gist.github.com/libreliodev/23f66ba0a2885b2b607f

cc @intrications

intrications commented 10 years ago

The crash report looks like it is referring to this drawable not existing or not being the correct type:

@drawable/startup_background

libreliodev commented 10 years ago

The crash report looks like it is referring to this drawable not existing or not being the correct type: @drawable/startup_background

@intrications : thanks for your quick answer

intrications commented 10 years ago

Here is where the image is set:

https://github.com/libreliodev/android/blob/master/res/layout/startup.xml#L12

If that line is removed then the splashscreen doesn't show the image.

No idea of the cause. Re-compiling has often fixed similar issues for me before. Was this using your bash script?

libreliodev commented 10 years ago

No idea of the cause. Re-compiling has often fixed similar issues for me before. Was this using your bash script?

No, this was reported by a client, using a version that has been downloaded several thousand times.

libreliodev commented 10 years ago

@intrications

Similar crash reported by another user: https://gist.github.com/libreliodev/f50ca6ed21e2d2be9e72

intrications commented 10 years ago

I think I may have found the problem.

There is no default version of the startup_background image. There are versions in drawable-port, drawable-land, drawable-xlarge-port, drawable-xlarge-land.

This should cover all options. However, there may be a glitch where the device is trying to show a default version which should be in the drawable folder.

Thinking about it, it may also be that the files should really be in a folder which includes the density of the image. However, in our case, this would be nodpi because we are fitting the image to the screen ourselves so the dpi is irrelevant. So the folders should be drawable-nodpi, drawablei-port-nodpi, etc. The drawable folders without density declared are left over from pre-Android API v4.

libreliodev commented 10 years ago

@intrications Thanks for the explanations.

So, renaming all our drawable folders to [oldname]-nodpi would be more appropriate now?

And, if we added a drawable-nodpi folder, we should avoid this crash?

intrications commented 10 years ago

@libreliodev

I can't guarantee any of this will stop the crash. The devices are obviously doing something that shouldn't strictly be happening.

Putting the drawables which are density independent in a -nodpi folder would be the correct thing to do. I have already done that in my copy of the sourcecode to test so I can push that to github if you are in agreement.

Just adding the drawable-nodpi folder probably wouldn't fix the crash. There needs to be a startup_background image in it. I think the image that is currently in drawable-port would be the most suitable image because portrait is the default. You could either duplicate the image or remove the drawable-port folder. Duplication would probably be easier to get wrong.

libreliodev commented 10 years ago

@intrications

Putting the drawables which are density independent in a -nodpi folder would be the correct thing to do. I have already done that in my copy of the sourcecode to test so I can push that to github if you are in agreement.

I agree, thanks.

Just adding the drawable-nodpi folder probably wouldn't fix the crash. There needs to be a startup_background image in it. I think the image that is currently in drawable-port would be the most suitable image because portrait is the default. You could either duplicate the image or remove the drawable-port folder. Duplication would probably be easier to get wrong.

I would suggest adding a black image as default, since it will be used only in rare cases.

intrications commented 10 years ago

Done. It is possible there are other images in drawable that should be moved to drawable-nodpi but we will see if there are other crashes.

libreliodev commented 10 years ago

Many thanks.