Sdl2/android - why not NativeActivity


#1

is there a reason why SDL2 on android relies on a java stub, rather than just being a library designed to slot into a NativeActivity app… wouldn’t this simplify the build process and setup (i.e you could have a project which is entirely native code - just the sdl2 so and your main so )

(i figured there might be a reason like it needs certain events which aren’t exposed through NativeActivity? … or is it to streamline setting up bits of platform UI ? )


#2

All Android apps must go through Java, which includes
NativeActivity. There is nothing special about NativeActivity. It is
implemented like SDL, where it goes through JNI to operate with the
proprietary Android/Java APIs needed to make an Android app work.

NativeActivity has a long history of not being terribly good and
neglected. Historically, it was never a built-in library in the
convenient, but something you would have to figure out how to build
into your own project & build system. Since there was no advantage to
using NativeActivity, most competent games and engines implemented
their own interface, like SDL.