I created an Android-videogame that uses processing-core.jar library. I used Intellij Idea to create this multiplatform project. When I try to launch the release build on my Tablet PC with Android 11 using USB-cable I see the next fatal exception in the Logcat and the game crushes at the start:
--------- beginning of crash
2023-07-01 15:36:59.606 27823-27823/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mgdsstudio.blueberet.mainpackage, PID: 27823
java.lang.VerifyError: Rejecting class processing.opengl.PSurfaceGLES that attempts to sub-type erroneous class processing.core.PSurfaceNone (declaration of 'processing.opengl.PSurfaceGLES' appears in /data/app/~~5Ws4-KwN5hRY-yoh2SvVUQ==/com.mgdsstudio.blueberet.mainpackage-cTpMnhr0eMQBvsspprh0DQ==/base.apk!classes3.dex)
at processing.opengl.PGraphicsOpenGL.createSurface(PGraphicsOpenGL.java:783)
at processing.core.PApplet.initSurface(PApplet.java:538)
at processing.android.PFragment.onCreateView(PFragment.java:149)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2995)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:523)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2849)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2784)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:262)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:478)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:251)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1435)
at android.app.Activity.performStart(Activity.java:8097)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3533)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2106)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7943)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.VerifyError: Verifier rejected class processing.core.PSurfaceNone: android.content.Context processing.core.PSurfaceNone.getContext() failed to verify: android.content.Context processing.core.PSurfaceNone.getContext(): [0x22] can't resolve returned type 'Reference: android.content.Context' or 'Unresolved Reference: android.support.wearable.watchface.WatchFaceService' (declaration of 'processing.core.PSurfaceNone' appears in /data/app/~~5Ws4-KwN5hRY-yoh2SvVUQ==/com.mgdsstudio.blueberet.mainpackage-cTpMnhr0eMQBvsspprh0DQ==/base.apk!classes3.dex)
Two customers with the same Android version can not also launch my videogame as the release build. But on my Android smartphone with Android 10 the videogame launches without errors. When I try to launch the debug version: it runs on every smartphone or tablet pc with Android 10 or Android 11.
When I change the language level from 17 to 14 in the build.gradle and change libraries from processing 4 through processing 3 the game works.