sharish / ShimmerRecyclerView

Other
4.02k stars 551 forks source link

Fatal Exception: java.lang.IllegalArgumentException: width and height must be > 0 #35

Closed vaibhav-droid closed 6 years ago

vaibhav-droid commented 6 years ago

I am getting this error in ShimmerLayout class. What could be the issue?

Fatal Exception: java.lang.IllegalArgumentException: width and height must be > 0 at android.graphics.Bitmap.createBitmap(Bitmap.java:815) at android.graphics.Bitmap.createBitmap(Bitmap.java:794) at android.graphics.Bitmap.createBitmap(Bitmap.java:761) at io.supercharge.shimmerlayout.ShimmerLayout.startShimmerAnimation(Unknown Source) at io.supercharge.shimmerlayout.ShimmerLayout.getSourceMaskBitmap(Unknown Source) at io.supercharge.shimmerlayout.ShimmerLayout.stopShimmerAnimation(Unknown Source) at io.supercharge.shimmerlayout.ShimmerLayout.startShimmerAnimation(Unknown Source) at io.supercharge.shimmerlayout.ShimmerLayout.dispatchDraw(Unknown Source)

veghtomi commented 6 years ago

@vaibhav-droid My question would be what version do you use and can you reproduce this exception?

sharish commented 6 years ago

@veghtomi : I could see here that width check is there while the height check is not. May be this issue is because of height not being checked?

veghtomi commented 6 years ago

@sharish yes, it is true. But this is an old version. For example at the new one there is no getSourceMaskBitmap method. Also there is just a getWidth check, but after when the animation first invalidates the view, at the dispatchDraw method there is a check and ultimately that will create the bitmap.

vaibhav-droid commented 6 years ago

@veghtomi I am using v1.3 and getting this error on HTC 4.4.2 and I am not able to reproduce it

dependencies { implementation 'com.github.sharish:ShimmerRecyclerView:v1.3' }

is there any other version for this

veghtomi commented 6 years ago

@vaibhav-droid no, that is the latest one. But still, ShimmerRecyclerView 1.3 uses ShimmerLayout 2.1.0 which do not have a method named getSourceMaskBitmap.

sharish commented 6 years ago

@vaibhav-droid Can you cross check your user's app version and what was the ShimmerRecyclerView's version in that app release

vaibhav-droid commented 6 years ago

yes, @sharish n @veghtomi .. the user who has reported this is having the previous version of your lib (v1.2). Hopefully, he won't get this again in new release. thanks for your time. I am closing this issue for now.