Using SDL2 with new android GameActivity

Can I use SDL2 just as C++ shared library with GameActivity? Google has released recently Android Game Development Kit GameActivity  |  Android Developers that allows avoid JNI. So I try to port my sdl2 desktop application to Android without using any java code related to SDL2 - is it possible?

2 Likes

Good question :+1:t2:

First I’ve heard of GameActivity. It appears to be backwards compatible to API level 16. My first guess is that it’s possible, but SDL’s Android scaffolding would need a complete rework; which would be a massive job and create all kinds of new problems.

Do you know what advantages this will have, if any? It seems tidier, but will there be performance improvements? simpler to develop?

I am not sure about performance improvements, but the main idea - simpler development, avoiding JNI, and possibility to use last Jetpack features with java/kotlin application part, as I understand.
There is explanation of this concept: C/C++ libraries for Android games - YouTube
Also, as I understand - according to this new concept there shouldn’t be java code in sdl2 at all.
It should works just like native cpp library.

There’s always Java, in the game activity docs above it says it just keeps the JNI there and you still need Java to work things out, it may be somewhat hidden but it’s there.

It’s easier if you have a Java/Kotlin Activity if you need to glue some android specific library later to your game.