SDL 2.0.6 (Android) : unsatisfied dependency on nativeInit

Hi everyone,
(First, thanks a lot for making such an awesome lib :))

I just joined this forum after noticing something weird when trying to build a sample application project (from this GitHub project) with SDL2 2.0.6.

First of all, I don’t have any problem to build it. It’s the execution phase that throws me an exception. Here is the error message (from adb logcat) :
java.lang.UnsatisfiedLinkError: No implementation found for int org.libsdl.app.SDLActivity.nativeInit(java.lang.Object) (tried Java_org_libsdl_app_SDLActivity_nativeInit and Java_org_libsdl_app_SDLActivity_nativeInit__Ljava_lang_Object_2)

I saw it could come from an ill formed apk with no libSDL2.so inside, but it was not my case.
I’m used to make SDL2 projects on desktop environment, but on Android, it’s my first SDL2 app, so after several hours not finding any solution on forums (SDL2 2.0.6 is quite recent), I tried to downgrade to SDL2 2.0.5, wondering if the error would be the same or not.

What a surprise when I saw it running without a problem after the first try !
After further investigation, I found that SDL_android_main.c doesn’t contain a nativeInit implementation anymore, since SDL2 2.0.6.

My questions are :

  • Is it a bug ?
  • Am I missing something with the installation of SDL2 2.0.6 ?

If required, I can provide extended error messages or any detail.

Sorry about my approximative english, I’m not a native speaker.
Thanks a lot !

1 Like

You have to build it with a matching SDLActivity.java. That file is part of SDL, and does get changed every release. You should compare it with the originally used SDL version (appears to be SDL 2.0.3) to make sure you don’t miss some modification like changing which libraries are loaded.

1 Like

Hello Jacob,

Thank you, that works !
I didn’t forget to replace the “SDLActivity” matching the SDL 2.0.6 src, but it seems I replaced it with the SDL 2.0.5 SDLActivity instead of the SDL 2.0.6… I’m in a rush and it appears I don’t do things correctly :slight_smile:
That was a dumb issue…
Thanks a lot again !