Hi, guys. I just got a weird problem:
My program is a simple Android app, a Box with Unshaded material.
Material mat0 = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat0.setColor("Color", ColorRGBA.Blue);
...
geomBox.setMaterial(mat0);
It works in Android studio’s emulator at api level 31 BUT failed in api level 21.
For hardwares, It passed in a device with api 29 (a xiaomi phone), failed in api 23 (a Samsung phone).
Android studio error message is shown below:
Resolution from Window, width:768, height: 1184
Rejecting re-init on previously-failed class java.lang.Class<com.jme3.system.JmeSystemDelegate$$ExternalSyntheticLambda0>
Rejecting re-init on previously-failed class java.lang.Class<com.jme3.system.JmeSystemDelegate$$ExternalSyntheticLambda0>
Rejecting re-init on previously-failed class java.lang.Class<com.jme3.system.android.JmeAndroidSystem$$ExternalSyntheticLambda1>
Rejecting re-init on previously-failed class java.lang.Class<com.jme3.system.android.JmeAndroidSystem$$ExternalSyntheticLambda1>
Rejecting re-init on previously-failed class java.lang.Class<com.jme3.system.JmeSystemDelegate$$ExternalSyntheticLambda0>
SEVERE Failed to create JmeSystem delegate:
{0}
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at com.jme3.system.JmeSystem.tryLoadDelegate(JmeSystem.java:238)
at com.jme3.system.JmeSystem.checkDelegate(JmeSystem.java:250)
at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:226)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:120)
at com.jme3.app.AndroidHarness.onCreate(AndroidHarness.java:248)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NoClassDefFoundError: com.jme3.system.JmeSystemDelegate$$ExternalSyntheticLambda0
at com.jme3.system.JmeSystemDelegate.<init>(JmeSystemDelegate.java:65)
at com.jme3.system.android.JmeAndroidSystem.<init>(JmeAndroidSystem.java:41)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at com.jme3.system.JmeSystem.tryLoadDelegate(JmeSystem.java:238)
at com.jme3.system.JmeSystem.checkDelegate(JmeSystem.java:250)
at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:226)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:120)
at com.jme3.app.AndroidHarness.onCreate(AndroidHarness.java:248)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
SEVERE Class com.cottonwoodanalytics.anno.core.AnnoCore init failed
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.jme3.system.JmeSystemDelegate.showSettingsDialog(com.jme3.system.AppSettings, boolean)' on a null object reference
at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:227)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:120)
at com.jme3.app.AndroidHarness.onCreate(AndroidHarness.java:248)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Render dirty regions requested: true
HostConnection::get() New Host Connection established 0x7f11fa0afc50, tid 5485
Validating map...
Shutting down VM
FATAL EXCEPTION: main
Process: com.cottonwoodanalytics.anno, PID: 5485
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cottonwoodanalytics.anno/com.cottonwoodanalytics.anno.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.opengl.GLSurfaceView com.jme3.system.android.OGLESContext.createView(android.content.Context)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.opengl.GLSurfaceView com.jme3.system.android.OGLESContext.createView(android.content.Context)' on a null object reference
at com.jme3.app.AndroidHarness.onCreate(AndroidHarness.java:256)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Sending signal. PID: 5485 SIG: 9
sdk version 3.6.0 and 3.5.2