Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorPickerView exception on startup when target SDK = 28: "IllegalArgumentException: x must be < bitmap.width()" #15

Closed
kiwiandroiddev opened this issue Sep 25, 2018 · 4 comments

Comments

@kiwiandroiddev
Copy link

kiwiandroiddev commented Sep 25, 2018

If the compile and target SDK versions are changed to 28 in the sample app then this exception will be thrown during initial layout:

09-25 16:36:31.481 7552-7552/com.skydoves.colorpickerviewdemo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.skydoves.colorpickerviewdemo, PID: 7552
    java.lang.IllegalArgumentException: x must be < bitmap.width()
        at android.graphics.Bitmap.checkPixelAccess(Bitmap.java:1780)
        at android.graphics.Bitmap.getPixel(Bitmap.java:1728)
        at com.skydoves.colorpickerview.ColorPickerView.getColorFromBitmap(ColorPickerView.java:211)
        at com.skydoves.colorpickerview.ColorPickerView.setSelectorPoint(ColorPickerView.java:356)
        at com.skydoves.colorpickerview.ColorPickerView.selectCenter(ColorPickerView.java:402)
        at com.skydoves.colorpickerview.ColorPickerView$1.onGlobalLayout(ColorPickerView.java:111)
        at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:945)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2357)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7183)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
        at android.view.Choreographer.doCallbacks(Choreographer.java:761)
        at android.view.Choreographer.doFrame(Choreographer.java:696)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Edit: reverting the targetSdkVersion to 27 and leaving the compileSdkVersion at 28 suppresses the issue. They must have introduced additional restrictions to Bitmap.getPixel() in Android 28

@skydoves
Copy link
Owner

I aware know this issue.
It will be fixed next version soon.
Thank you for your issue!

@kiwiandroiddev
Copy link
Author

Awesome, thank you :)

@skydoves
Copy link
Owner

It's fixed at version 2.0.1!
Thank you!

@savejraees
Copy link

still not fixed upto 2.2.3 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants