1

BubbleTransition on some old devices (4.0.4 and lower) immediately crashes application with UnsupportedOperationException (viewed trace via Android Studio).

Stack trace guided me to some image clipping method.

How to check if clipping is supported on current platform to avoid crashes?

Stack trace

E/AndroidRuntime: FATAL EXCEPTION: main
              java.lang.UnsupportedOperationException
                  at android.view.GLES20Canvas.clipPath(GLES20Canvas.java:417)
                  at com.codename1.impl.android.AndroidGraphics.setClipRaw(AndroidGraphics.java:1368)
                  at com.codename1.impl.android.AndroidAsyncView$AsyncOp.executeWithClip(AndroidAsyncView.java:144)
                  at com.codename1.impl.android.AndroidAsyncView.dispatchDraw(AndroidAsyncView.java:229)
                  at android.view.View.getDisplayList(View.java:10519)
                  at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2701)
                  at android.view.View.getDisplayList(View.java:10484)
                  at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2701)
                  at android.view.View.getDisplayList(View.java:10484)
                  at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2701)
                  at android.view.View.getDisplayList(View.java:10484)
                  at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2701)
                  at android.view.View.getDisplayList(View.java:10484)
                  at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2701)
                  at android.view.View.getDisplayList(View.java:10484)
                  at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:851)
                  at android.view.ViewRootImpl.draw(ViewRootImpl.java:1910)
                  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
                  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
                  at android.os.Handler.dispatchMessage(Handler.java:99)
                  at android.os.Looper.loop(Looper.java:137)
                  at android.app.ActivityThread.main(ActivityThread.java:4441)
                  at java.lang.reflect.Method.invokeNative(Native Method)
                  at java.lang.reflect.Method.invoke(Method.java:511)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
                  at dalvik.system.NativeStart.main(Native Method)

Possible CN1 implementation fix

Possibly could be fixed by a check for the Android API level and below API 18 disable hardware acceleration with

setLayerType(View.LAYER_TYPE_SOFTWARE, null)

The problem is related to forced hardware acceleration on ICS devices. But it is related to CN1 implementation, so there is nothing I can do with it.

  • Please check the page How to create a Minimal, Complete, and Verifiable example (http://stackoverflow.com/help/mcve) – pringi Jan 18 '17 at 17:19
  • Can you please include the full stack trace, copy and paste it from Android Studio into the question (you can edit it) and then comment here so I will get a notification that you edited the question. – Shai Almog Jan 19 '17 at 04:32
  • @ShaiAlmog added stack trace and found possible solution: http://stackoverflow.com/questions/13676059/android-unsupportedoperationexception-at-canvas-clippath –  Jan 28 '17 at 13:44

1 Answers1

0

Thanks we'll fix it for the next update coming on Friday February 3rd 2017. The fix will disable shaped clipping for the older devices which will force the bubble transition into compatibility mode.

The reason for this approach is that we wouldn't want the whole device to slow down because of one missing feature, I'd rather avoid shape clipping than have performance suffer.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • "...you can turn off hardware acceleration for just the affected portion of your application by calling `setLayerType(View.LAYER_TYPE_SOFTWARE, null)` This way, you can still take advantage of hardware acceleration everywhere else..." Source: https://developer.android.com/guide/topics/graphics/hardware-accel.html –  Jan 31 '17 at 11:25
  • This isn't applicable in our case – Shai Almog Feb 01 '17 at 05:44