How To Build Qt SDL Application in Android ?
-
Following are the Android Settings used :
NDK - android-ndk-r10e
SDK - 26.1.1
JDK - 1.8
API level - Android-16 and Android -17
ABI - armeabiV7aFollowing are the procedure followed :
- Download SDL2 source code and extract 'android-project' folder from it and renamed it to the name of my project.
2 . Create a symbolic link of SDL2 as ./SDL inside 'app' folder. - Modify 'Android.mk' with the name of the source file in 'LOCAL_SRC_FILES' and set CFLAGS.
- Run ndk-build from jni > src folder and on successful build libsdl.so and libmain.so is generated.
- Include these .so files in qt pro file under 'ANDROID_EXTRA_LIBS'.
- clean , qmake , build was successful.
- On Running the application with same source code as mentioned in Android.mk , following error was displayed and the application got crashed :
D/dalvikvm( 1431): Trying to load lib /data/data/org.qtproject.example.testSdlQt/lib/libtestSdlQt.so 0x9f0113c8
D/dalvikvm( 1431): Added shared lib /data/data/org.qtproject.example.testSdlQt/lib/libtestSdlQt.so 0x9f0113c8
D/dalvikvm( 1431): No JNI_OnLoad found in /data/data/org.qtproject.example.testSdlQt/lib/libtestSdlQt.so 0x9f0113c8, skipping init
E/ ( 1431): dlsym failed: Symbol not found:
E/ ( 1431): Could not find main method
F/libc ( 1431): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1450 (qtMainLoopThrea)
I/DEBUG ( 651): pid: 1431, tid: 1450, name: qtMainLoopThrea >>> org.qtproject.example.testSdlQt <<<
D/Zygote ( 654): Process 1431 terminated by signal (11)
I/ActivityManager( 837): Process org.qtproject.example.testSdlQt (pid 1431) has died.
"org.qtproject.example.testSdlQt" died. - Download SDL2 source code and extract 'android-project' folder from it and renamed it to the name of my project.