I’m rather new to Android development, though I have successfully built a couple basic SDL apps for my Droid4 4.1.2 phone so far. However, I have now run up against a problem when attempting to use SDL2_ttf. The build succeeds and app-debug.apk is installed to the phone. Upon running though, the following error is displayed:
SDL Error
An error occurred while trying to start the
application. Please try again and/or reinstall.
Error: Cannnot load library:
link_image[1895]: 216 could not load needed library
'libSDL2_ttf.so' for 'libmain.so' (load_library[1097]:
Library 'libSDL2_ttf.so' not found)
The libSDL2_ttf.so file is getting into app-debug.apk, as can be below, so I’m clueless as to why it can’t be found.
$ unzip -l ./app/build/outputs/apk/app-debug.apk \*libSDL2_ttf.so
Archive: ./app/build/outputs/apk/app-debug.apk
Length Date Time Name
--------- ---------- ----- ----
587260 1980-00-00 00:00 lib/armeabi-v7a/libSDL2_ttf.so
620020 1980-00-00 00:00 lib/armeabi/libSDL2_ttf.so
1181024 1980-00-00 00:00 lib/mips/libSDL2_ttf.so
771476 1980-00-00 00:00 lib/x86/libSDL2_ttf.so
I’ve put the full source at http://rut.org/min.c
The exact steps I’m using for the build are:
androidbuild.sh org.rut.min min.c /usr/include/SDL2/SDL_ttf.h
cd /home/me/SDL2-2.0.8/build/org.rut.min
ln -s /home/me/SDL2_ttf-2.0.14/ app/jni/SDL_ttf
ln -s . app/jni/src/SDL2
sed -i 's/^LOCAL_SHARED_LIBRARIES.*/& SDL2_ttf/' app/jni/src/Android.mk
./gradlew installDebug