godot: The default Godot 4.2.1 application crashes in compatible mode on the Redmi 4X with OpenGL ES 3.2

Here is my topic on the Godot forum: https://forum.godotengine.org/t/run-time-error-on-android/36928

Tested versions

Godot 4.2.1 in compatible mode:

image

System information

Window 10, Redmi 4X (OpenGL ES 3.2)

image

I wrote a simple application in Qt that shows an OpenGL version:

image

Issue description

The application crashes on the Redmi 4X with the message:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mygame/com.godot.game.GodotApp}: java.lang.IllegalStateException: Unable to initialize engine native layer
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2723)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2784)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1523)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6238)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
Caused by: java.lang.IllegalStateException: Unable to initialize engine native layer
at org.godotengine.godot.GodotFragment.performEngineInitialization(GodotFragment.java:191)
at org.godotengine.godot.GodotFragment.onCreate(GodotFragment.java:182)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2949)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1971)
at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:311)
at org.godotengine.godot.GodotActivity.onCreate(GodotActivity.kt:84)
at com.godot.game.GodotApp.onCreate(GodotApp.java:45)
at android.app.Activity.performCreate(Activity.java:6857)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2676)
... 9 more

Steps to reproduce

Build to the device with OpenGL ES 3.2. In my case I use Redmi 4X

Minimal reproduction project (MRP)

FirstProject.zip

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 30 (17 by maintainers)

Most upvoted comments

If you run project in pc with F5 key,it will let you select main scene.

I was able to run it with your project after exporting it, but not with the apk you provided, it pops up a popup like yours. After comparing the two apk files, I realized that you didn’t set the main scene to run, and the scene is missing from your apk. 7zFM_kRKna43NqA

Yes, it works on Redmi 4X! I think Godot 4.2.2 will not have this bug. When 4.2.2 will be released?

@8Observer8 a pull request was just created here.

I will soon create a Draft Pull Request as soon as I have found a solution for the GL-Context problem. https://github.com/godotengine/godot/issues/86112#issuecomment-1898564926

So far we have tried 2D projects, we still need to test 3D projects withspot light + shadow https://github.com/godotengine/godot/issues/86112#issuecomment-1896098062

@joined72 if you have time: https://github.com/godotengine/godot-demo-projects

Note: not all projects are optimized for OpenGL ES3. There are also Vulkan demos that do not work as they should on Android.

Yes, it works on Redmi 4X! I think Godot 4.2.2 will not have this bug. When 4.2.2 will be released?

@8Observer8 I have just fixed a bug that could be strict related to your, can you test the following .APK file and tell to me if works fine, please?

GLES3_Test.apk

From my tests on an old Android devices that works fine on GLES3 on others apps and crashes on Godot 4, I think the real problem with GLES3 Rendering AREN’T the old Android devices GLES buggy drivers, as many developers states, but a Godot initialization bugs of the GLES3 Rendering.

@joined72 if you have time: https://github.com/godotengine/godot-demo-projects

I’m currently working on the “Wrong Rotation Bug” but I will try to do my best on this too.

On my Samsung Tab (2016, Android 8) no problems with ‘MRP’: FirstProject.zip

but with your exported APK, what saierXP has already found out:

12-31 16:46:01.953 11228 11228 I godot   : Error: Can't run project: no main scene defined in the project.
12-31 16:46:02.155 11228 11228 E Godot   : Unable to setup the Godot engine! Aborting...
12-31 16:46:02.254 11228 11228 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test/com.godot.game.GodotApp}: java.lang.IllegalStateException: Unable to initialize engine native layer

I find this error strange ClassNotFoundException, also seen in your logs. I can only reproduce this in my projects if I have not selected the appropriate CPU architecture. In your APK file I see “/lib/armeabi-v7a” (arm32), but my old Samsung tablet is also “arm32”

12-31 16:46:01.792 11228 11228 I zygote  : Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.WindowInsetsAnimation$Callback" on path: DexPathList[[zip file "/data/app/com.example.test-XMzITyU375If57l4l3H8Qw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.test-XMzITyU375If57l4l3H8Qw==/lib/arm, /data/app/com.example.test-XMzITyU375If57l4l3H8Qw==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]

Seems like the APK are trying to using an Android 11 WindowInsetsAnimation API on an old Android version. I found a similar bug too. I think this would be to investigate too.

PS: currently I’m out of my office where I have some logcat with many of those errors occurred.

Unable to initialize engine native layer I could not find (result.zip)

logcat
12-31 09:17:20.076  8813  8939 I Adreno  : QUALCOMM build                   : dd15ef5, Ic280a69317
12-31 09:17:20.076  8813  8939 I Adreno  : Build Date                       : 05/09/17
12-31 09:17:20.076  8813  8939 I Adreno  : OpenGL ES Shader Compiler Version: XE031.09.00.04
12-31 09:17:20.076  8813  8939 I Adreno  : Local Branch                     : 
12-31 09:17:20.076  8813  8939 I Adreno  : Remote Branch                    : quic/gfx-adreno.lnx.1.0.r5-rel
12-31 09:17:20.076  8813  8939 I Adreno  : Remote Branch                    : NONE
12-31 09:17:20.076  8813  8939 I Adreno  : Reconstruct Branch               : NOTHING
12-31 09:17:20.113  8758  8758 I Finsky  : [1] sbr.ajn(13): DTU: Received onPackageAdded, replacing: false
12-31 09:17:20.213  8813  8938 W RegularContextFactory: creating OpenGL ES 3.0 context :
12-31 09:17:20.221  8813  8939 I OpenGLRenderer: Initialized EGL, version 1.4
12-31 09:17:20.221  8813  8939 D OpenGLRenderer: Swap behavior 1
12-31 09:17:20.233  8813  8813 W art     : Long monitor contention with owner GLThread 2654 (8938) at void org.godotengine.godot.gl.GLSurfaceView$GLThread.guardedRun()(GLSurfaceView.java:1330) waiters=0 in void org.godotengine.godot.gl.GLSurfaceView$GLThread.queueEvent(java.lang.Runnable) for 129ms
12-31 09:17:20.272  8813  8938 I godot   : Godot Engine v4.2.1.stable.official.b09f793f5 - https://godotengine.org
------------
12-31 09:17:20.689  1536  1561 I ActivityManager: Displayed com.example.test/com.godot.game.GodotApp: +10s266ms
------------
12-31 09:17:22.378  8813  8938 I godot   : OpenGL API OpenGL ES 3.2 V@145.0 (GIT@Ic280a69317) - Compatibility - Using Device: Qualcomm - Adreno (TM) 505
12-31 09:17:22.380  8758  8758 I Finsky  : [1] apcc.e(7): registerListener
12-31 09:17:22.425  8813  8938 I godot   :  
12-31 09:17:22.468  8813  8938 I libOpenSLES: Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
--------

12-31 09:17:24.997  8813  8938 D Godot   : OnGodotSetupCompleted
12-31 09:17:25.054  8758  8832 I Finsky  : [22667] mac.ain(129): [ContentSync] finished, scheduled=true
12-31 09:17:25.084  8813  8938 D Godot   : OnGodotMainLoopStarted

You could still try ‘OpenGL Debug’, maybe we will see more when the problem with the “native layer” is solved.

Bildschirmfoto 2023-12-31 um 14 50 31