Hi,
I’ve been using this project code found here: https://github.com/fallahn/sdl2vs for a template app for android.
Compilation and setup goes relatively painlessly, but the app crashes in GradleApp section in SDL.java when calling SDLActivity.nativeSetupJNI()
public static void setupJNI()
{
SDLActivity.nativeSetupJNI(); // CRASH HERE!
SDLAudioManager.nativeSetupJNI();
SDLControllerManager.nativeSetupJNI();
}
IDE: VS2019 Community (C++)
SDL2.0.10 on Win10
AndroidSDK 26
AndroidNDK r20 x86_64
Logcat output:
Force stopping com.SDL2_GradleApp appid=10085 user=-1: set debug app
START u0 {flg=0x10000000 cmp=com.SDL2_GradleApp/.SDL2_GradleApp} from uid 2000
Start proc 4606:com.SDL2_GradleApp/u0a85 for activity com.SDL2_GradleApp/.SDL2_GradleApp
Application com.SDL2_GradleApp is waiting for the debugger on port 8100...
Device: generic_x86
Model: Android SDK built for x86
onCreate()
nativeSetupJNI()
Force finishing activity com.SDL2_GradleApp/.SDL2_GradleApp
Showing crash dialog for package com.SDL2_GradleApp u0
Process com.SDL2_GradleApp (pid 4606) has died: vis +99TOP
Java Callstack to crash
> | org.libsdl.app.SDL.setupJNI Line 15 | Java |
---|---|---|
org.libsdl.app.SDLActivity.onCreate(android.os.Bundle savedInstanceState) Line 237 | Java | |
com.SDL2_GradleApp.SDL2_GradleApp.onCreate(android.os.Bundle savedInstanceState) Line 13 | Java | |
android.app.Activity.performCreate(android.os.Bundle icicle) Line 6975 | Java | |
android.app.Instrumentation.callActivityOnCreate(android.app.Activity activity, android.os.Bundle icicle) Line 1213 | Java | |
android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord r, android.content.Intent customIntent) Line 2770 | Java | |
android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord r, android.content.Intent customIntent, java.lang.String reason) Line 2892 | Java | |
android.app.ActivityThread.-wrap11(android.app.ActivityThread -this, android.app.ActivityThread$ActivityClientRecord r, android.content.Intent customIntent, java.lang.String reason) | Java | |
android.app.ActivityThread$H.handleMessage(android.os.Message msg) Line 1593 | Java | |
android.os.Handler.dispatchMessage(android.os.Message msg) Line 105 | Java | |
android.os.Looper.loop Line 164 | Java | |
android.app.ActivityThread.main(java.lang.String[] args) Line 6541 | Java | |
java.lang.reflect.Method.invoke | Java | |
com.android.internal.os.Zygote$MethodAndArgsCaller.run() Line 240 | Java | |
com.android.internal.os.ZygoteInit.main(java.lang.String[] argv) Line 767 | Java |
Relevant Debug output:
Loaded 'android.view.View$OnSystemUiVisibilityChangeListener'
Loaded 'org.libsdl.app.SDLActivity'
Loaded 'com.SDL2_GradleApp.SDL2_GradleApp'
Loaded 'org.libsdl.app.SDLActivity$SDLCommandHandler'
Loaded 'org.libsdl.app.SDLActivity$7'
Loaded 'org.libsdl.app.SDL'
Exception thrown: java.lang.NullPointerException
Exception thrown: java.lang.NullPointerException
I can confirm that SDL2.0.5 on Ant works fine.
This happens to me only on gradle on VS2019 and VS2017. It happens on ARM and x86 builds. Emulated and physical device. I also tried all the combinations of Android SDK and NDK and app always crashes at this point.
Can anyone confirm this is happening to them? The link to the github project should work if VS and AndroidSDK and NDK are installed. I’ve been on this and other Android issues for 20 hours now and I’m going insane. It’s just a never ending stream of problem after problem after problem. I’ve never seen anything like it in 20 years…
Thanks