SLD2 on Android "Failed, there is no JavaVM"

I’ve statically linked SDL2 into my C++ application .so which is loaded from a Java class extending SDLActivity. However, after being launched on a physical device the app crashes and I see the following in logcat:

V/SDL: onCreate()
W/SDL: Request to get environment variables before JNI is ready
E/SDL: Failed, there is no JavaVM
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 26103 (SDLActivity), pid 26103 (SDLActivity)

I’m able to launch my other C++ projects which use ANativeActivity on this device without any issues, so the problem is not with the device itself.

Maybe this PR is relevant to you: SDLActivity.java can be silently out of date · Issue #1540 · libsdl-org/SDL · GitHub