noClip() crashes my Android app

When the exported app is started on a Galaxy S8+ (Android 10) via “Run on Device”, the noClip() command crashes the program. When I start the app in an emulator, it works fine (Android 9). My app renders plots in a rectangle and uses clip and noClip() to restict line() output to that rectangle:

clip(Plot_X, Plot_Y, Plot_W, Plot_H);

noClip();

I get this crash report:

FATAL EXCEPTION: Animation Thread
Process: com.fabsoft.statusmonitor, PID: 22542
java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
at android.graphics.Canvas.checkValidClipOp(Canvas.java:779)
at android.graphics.Canvas.clipRect(Canvas.java:918)
at processing.a2d.PGraphicsAndroid2D.noClip(PGraphicsAndroid2D.java:535)
at processing.core.PApplet.noClip(PApplet.java:8632)
at com.fabsoft.statusmonitor.statusmonitor.RenderPlots(statusmonitor.java:4397)
at com.fabsoft.statusmonitor.statusmonitor.draw(statusmonitor.java:1926)
at processing.core.PApplet.handleDraw(PApplet.java:1852)
at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:476)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:516)

Is there a solution, such as calling a Java command with the correct argument instead of Processing’s noClip()?


  • I still use Processing 3.4 because Processing 4 seems buggy (resizing my apps under Windows often hangs the apps).

  • I have installed the Android mode and the Android SDK manually. Installing everything (latest Android mode and Android sdk) through Processing 3 leads to a non-funcional setup - builds fail with “some licences have not been accepted”. I have installed SDK for Android 9.0 API level 28 via Android Studio and I use Android mode 4.1.1.