Run time error on Android

Godot Version

4.2.1

Question

Why does this error happen? I tried to run on devices with Android 7 and Android 13. The device with Android 7 shows the message below but the device with Android 13 shows nothing. I see the Godot Engine logo before the application stops.

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
1 Like

Which phones are you using?
Maybe they are not support vulkan renderer…

1 Like
  1. Redmi 4x
  2. Infinix Hot 30

I think the second one doesn’t support Vulkan either because it costs $110 only. I want to develop for budget phones too.

Is the solution to use Godot 3? Or can I switch Godot 4 to OpenGL ES 3?

try compatibility renderer first

1 Like

I tried it on Readmi 4x:

image

But I have the same errors like before. Redmi 4x supports ES 3.1. I will try to run the app on Infinix later.

I tried to run the app with Godot 4 on Infinix Hot 30 in “Compatibility” mode but it stops without messages. I think the solution will be to use Godot 3 for phones that don’t support Vulkan.

I found a bug that caused GLES3 crash in old devices, take a look here:

Was an old Godot 3.2 bug, but I think it was propagated to the 4.2 version too.

1 Like

It is very sad. I decided to use Qt C++, pure OpenGL ES 2.0, Box2D, Bullet Physics, OpenAL and FreeTexturePacker

My few examples in pure WebGL 1.0 and Box2D-WASM:

Qt C++ and OpenGL ES 2.0 on Redmi 4X:

Yes I understand, but it’s this power and flexible as Godot is? :frowning:

Developers of Godot decided to focus on powerful devices that has Vulkan. It’s impossible now to build apps for Android with OpenGL ES 2.0. I cannot develop for Redmi 4x anymore. I want to develop for budget devices. I didn’t tried Godot 3 because I think it will be deprecated soon. I tried libGDX yesterday but Android Studio is too heavy for my laptop ASUS K53SV. Qt Creator is lightweight and it’s easy to build for Android. It has built-in modules for WebSockets, SQLite, JSON, XML and so on. I wrote simples examples with OpenAL, Box2D and Bullet Physics that I has run on physical Android devices.

I extracted some models, textures and animations from the original Resident Evil game. I want to make mini games with multiplayer to study Bullet Physics. I want to make it for education as hobby. This is my WebGL examples: https://8observer8.github.io/ I imported models to pure WebGL. Now I want to import them to Qt OpenGL for Android:

jill-animations-webgl-js

barry-animations-webgl-js

1 Like

Really impressive, congratulation. :wink:

Can I ask you to port your game on gles3 just to test if it’s your device gles3 issue or, as I think, a Godot gles3 misconfiguration bug?

1 Like

I wrote an example on Qt6 and OpenGL that shows a version of OpenGL ES. It is ES 3.2 on my Redmi 4X. I run it on the physical device. I use scrcpy to show the physical Android screen to computer:

image

It works on Windows too (must work on Linux, macOS, iOS and even web with QtWebAssembly module) on one code base in C++. Qt has the same signal/slot mechanism like Godot

image

#include <QtGui/QOpenGLFunctions>
#include <QtGui/QSurfaceFormat>
#include <QtOpenGLWidgets/QOpenGLWidget>
#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>

class OpenGLWidget : public QOpenGLWidget, private QOpenGLFunctions
{
    Q_OBJECT

signals:
    void showInfoSignal(const QString &openGLVersion, const QString &shadingVersion, const QString &vendor);

private:
    void initializeGL() override
    {
        initializeOpenGLFunctions();
        glClearColor(0.f, 1.f, 0.f, 1.f);
        QString version(QString("OpenGL version: %1").arg((const char*) glGetString(GL_VERSION)));
        QString shadingLanguageVersion(QString("GLSL version: %1").arg((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)));
        QString vendor(QString("Vendor: %1").arg((const char*) glGetString(GL_VENDOR)));
        emit showInfoSignal(version, shadingLanguageVersion, vendor);
    }

    void paintGL() override
    {
        glClear(GL_COLOR_BUFFER_BIT);
    }
};

class MainWindow : public QWidget
{
    Q_OBJECT
public:
    MainWindow()
    {
        setWindowTitle("OpenGL Version");
        resize(300, 300);

        m_openGLVersionLabel = new QLabel();
        m_shadingLanguageVersionLabel = new QLabel();
        m_vendorLabel = new QLabel();
        OpenGLWidget *openGLWidget = new OpenGLWidget();

        m_openGLVersionLabel->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed);
        m_shadingLanguageVersionLabel->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed);
        m_vendorLabel->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed);

        QVBoxLayout *layout = new QVBoxLayout();
        layout->addWidget(m_openGLVersionLabel);
        layout->addWidget(m_shadingLanguageVersionLabel);
        layout->addWidget(m_vendorLabel);
        layout->addWidget(openGLWidget);
        setLayout(layout);

        connect(openGLWidget, &OpenGLWidget::showInfoSignal, this, &MainWindow::showInfoSlot);
    }

private slots:
    void showInfoSlot(const QString &openGLVersion, const QString &shadingVersion, const QString &vendor)
    {
        m_openGLVersionLabel->setText(openGLVersion);
        m_shadingLanguageVersionLabel->setText(shadingVersion);
        m_vendorLabel->setText(vendor);
    }

private:
    QLabel *m_openGLVersionLabel;
    QLabel *m_shadingLanguageVersionLabel;
    QLabel *m_vendorLabel;
};

#include "main.moc"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}

So my device (Redmi 4X) supports ES 3.2 but why Godot 4 application does not work when I run in this mode that must support even ES 3.0:

image

I heard that Ramatak wanted to support old “potato” phones better. :grin:

I will use libGDX/Java, Qt/OpenGL/C++ and WebGL/JS. Maybe later the problem was solved in Godot 4.

Now I know how to work with libGDX from the command line to build apps for Android and Desktop (I didn’t try to build for HTML5). I use Sublime Text 4 with libGDX. Android Studio is too slow for my laptop and makes it noisy. Sublime Text 4 works like Notepad++ - very fast.

It is simple to run libGDX build from command line:

  • Go to the generated folder:
    image

  • Run this commands to run on the Desktop: "./gradlew" desktop:run

  • Run this commands to run on the Android: "./gradlew" android:installDebug

It is require 2-3 second to run on Desktop and 5-6 seconds to run on Android. At first time Gradle require a few minutes to build.

How it looks in Sublime Text 4 (one code base in the core directory):

How it looks on physical Android device using scrcpy:

image

My device really has OpenGL ES 3.2:

Can I sincerely ask you to open a new Godot 4.2.1 bug issue on GitHub, attaching all the docs and photo of this thread, explaining that the Godot 4 Compatibility GLES3 Rendering issues AREN’T related to any old Android Devices GLES drivers bug, but ONLY to Godot GLES3 misconfigurations/bugs?

We definitively need the Godot Devs start to work and fixes all this issues to can work on Android because it’s really impossible that a device with 3.2 GLES support works fine with other engines and crash on Godot 4.

Open a new issue here:

1 Like

Done: The default Godot 4.2.1 application crashes in compatible mode on the Redmi 4X with OpenGL ES 3.2 · Issue #86565 · godotengine/godot · GitHub

Thanks, I’m commenting on it.

1 Like

I want buy an used Redmi 4x to can further test and fix this bug, can you tell me the exact device code so that I can buy the correct Redmi 4x version, please?

1 Like