question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed

See original GitHub issue

Running the crop activity on android P dp3 causes this error. it causes my app to crash. I’ll put the full stacktrace below: 06-08 17:49:51.044 16313-16313/nl.jolanrensen.clockwidget E/AndroidRuntime: FATAL EXCEPTION: main Process: nl.jolanrensen.clockwidget, PID: 16313 java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed at android.graphics.Canvas.checkValidClipOp(Canvas.java:779) at android.graphics.Canvas.clipPath(Canvas.java:1007) at com.theartofdev.edmodo.cropper.CropOverlayView.drawBackground(CropOverlayView.java:635) at com.theartofdev.edmodo.cropper.CropOverlayView.onDraw(CropOverlayView.java:579) at android.view.View.draw(View.java:20205) at android.view.View.updateDisplayListIfDirty(View.java:19080) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19071) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19071) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19071) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19071) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19071) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20208) at com.android.internal.policy.DecorView.draw(DecorView.java:780) at android.view.View.updateDisplayListIfDirty(View.java:19080) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:685) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:691) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:799) at android.view.ViewRootImpl.draw(ViewRootImpl.java:3263) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3079) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2459) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1447) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7130) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:935) at android.view.Choreographer.doCallbacks(Choreographer.java:747) at android.view.Choreographer.doFrame(Choreographer.java:682) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:921) 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:6642) 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: this only seems to happen with OVAL. RECTANGLE doesn’t make it crash.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:11
  • Comments:22

github_iconTop GitHub Comments

10reactions
Pauligrindercommented, Oct 22, 2018

I got around the issue with this for now: .setCropShape(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P ? CropImageView.CropShape.RECTANGLE : CropImageView.CropShape.OVAL) It shows the cropping view as a rectangle in Android P and above, but at least it doesn’t crash. I’ll change it back to oval only once the problem is resolved…

8reactions
korobkoffcommented, Sep 18, 2018

I’ve got this crash error both at Android P emulator and real devices using Android P.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - java.lang.IllegalArgumentException: Invalid Region.Op
java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE. The issue with targetSdkVersion 28.
Read more >
java.lang.IllegalArgumentException: Invalid Region ... - GitHub
java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed at android.graphics.Canvas.
Read more >
Java.Lang.IllegalArgumentException: Invalid Region.Op
Java.Lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed occurred. Fixed In: Visual Studio 2019 version 16.2 ...
Read more >
Pixel 2 crash - only INTERSECT and DIFFERENCE are allowed
I'm testing my app using firebase's test lab, and it seems to crash upon opening on pixel 2's with the above error message....
Read more >
Invalid Region.Op - only INTERSECT and DIFFERENCE are ...
java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed at android.graphics.Canvas.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found