Porting SDL3 game to android

158 Views Asked by At

I've been trying to port my SDL3 game to android, the application builds, but upon opening the application it crashes immediately, I looked into logcat and it prints this error: Error

                                                                                                    runtime.cc:699]     in call to FindClass
                                                                                                    runtime.cc:699]     from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class)
2023-07-03 20:15:55.504 20280-20280 libc                    org.home.koogel                      A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 20280 (SDLActivity), pid 20280 (SDLActivity)
2023-07-03 20:15:56.495 20430-20430 DEBUG                   pid-20430                            A  Cmdline: org.home.koogel
2023-07-03 20:15:56.495 20430-20430 DEBUG                   pid-20430                            A  pid: 20280, tid: 20280, name: SDLActivity  >>> org.home.koogel <<<
2023-07-03 20:15:56.495 20430-20430 DEBUG                   pid-20430                            A        #10 pc 000000000023c2bb  /data/app/~~N53rLpZY9mh-E3GtGYnN6Q==/org.home.koogel-igXmQKQnrfbvP2nKt24nXg==/lib/x86_64/libSDL3.so (BuildId: 92dd810fbcc704969f477fe80d5f650c31ba6464)
2023-07-03 20:15:56.495 20430-20430 DEBUG                   pid-20430                            A        #11 pc 000000000023c1f6  /data/app/~~N53rLpZY9mh-E3GtGYnN6Q==/org.home.koogel-igXmQKQnrfbvP2nKt24nXg==/lib/x86_64/libSDL3.so (JNI_OnLoad+182) (BuildId: 92dd810fbcc704969f477fe80d5f650c31ba6464)
---------------------------- PROCESS ENDED (20280) for package org.home.koogel ----------------------------

It seems like it cannot find SDL, even though I've specified the path to SDL in local properties, and It uses an SDL library to build. SDLActivity:

    protected String[] getLibraries() {
        return new String[] {
            "c++_shared",
            "SDL3",
            "loader",
            "image_engine",
            "image"
        };
    }

local.properties:

sdk.dir=/home/koogel/Android/Sdk
sdl3.dir=/home/koogel/SDL/
cmake.dir =/usr/

build.gradle

//adding of the SDL3 directory
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def sdl3Dir = properties.getProperty('sdl3.dir')
if (sdl3Dir == null)
{
    throw new IllegalArgumentException("no [sdl3.dir] property in [local.properties] file")
}

This is actually a second time I'm reworking this project as the last time the project was built with deprecated functions and was based on the example, now I want to make my own project

1

There are 1 best solutions below

0
koogel On

The issue was with the name of the namespace, the namespace should've been org.koogel, instead of koogel.