Yes, native methods can be implemented directly in your libmain.so.
see src/core/SDL_android.c for examples of implementations.
you also need some prototype in you java file (ex: “public static native void nativeLowMemory();” )
Sorry, I’m in need of a bit of a nudge. Attempting to call my native method is crashing the app:
01-08 21:55:48.200 31995-31995/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: Native method not found: org.libsdl.app.MainActivity.NativeTest:()V
at org.libsdl.app.MainActivity.NativeTest(Native Method)
at org.libsdl.app.MainActivity.onCreate(MainActivity.java:407)
at android.app.Activity.performCreate(Activity.java:5276)
In one of my .cpp files (belongs to my ‘main’ module’s Android.mk):
Thank you! Yes -that’s the problem - C vs C++ linkage. I wonder what needs to be changed to call C++ methods instead from Java. I got 2 JNI books and they both show identical function definitions for C and C++.