SDL Android Project


after following the lazyfoo tutorial i was able to port is hellomobile.cpp with 3 libs(SDL,images,ttf and mixer), once i was sure,i added my src to it, but it seems there is issues i just dont know to what to do now:(

i am getting this undefined reference, while the same project in visual studio for windows is running fine.


Is it just me, or is the pic utterly blurry?


open the link, it is not blurry… :frowning:


Oh, it’s not… I did it on my tablet, there was no magnifying glass. Sending pictures with errors to developers is like sending text if you could send a picture of your new car to your friends =) I can’t read it. The messages are cut off. Looks like it can’t find the engine
Your target is MIPS?

Most of the tutorials for building on Android are heavily outdated and a lot fiddling is asked.


no i did not target mips, but i was getting the android depricated so i read in stackoverflow to add mips, but that didnt change anything, i will give u more info on the error , right now i am at work :frowning:

Try this search =) My last build was command line ndk. Gonna try Android Studio build in 2 weeks.
Good luck!


I’ve spent 3 weeks wrestling with Android Studio to get SDL & SDL_mixer to work. It wasn’t fun, but I did it and it works with the latest Gradle and Build Tools. I even got full screen AdMob ads and OpenURL working by making custom JNI functions. So, if you need help, I’m your man. I didn’t copy SDL or use simlinks - I did it so all projects share the same SDL source directory. I’m thinking of putting a tutorial together? All the other tutorials I tried didn’t work.

Posting a picture doesn’t give much away. Really need to see all your .mk and Gradle files.


Awesome! I will definitely come back to you! I am still working on timing and state integration. Since I am not satisfied with my timing, started to getting ambitious on that. I spent way too much time on Animations, damn they are so time consuming. In my next life I use Unity, hahaha. One can’t really write good software if timing isn’t proper and physics will be a mess. Ofc I would encourage you to set up at least a gist, if you are like me you forget the half in two weeks =)

Yes, I was not messing. I can’t emphasize that often enough. Tiny well set up steps in development - it pays out (stress level wise) and using one of those to show off what you have done is gold.
Yesterday I lost like 3h cause I was messing with CPU-time instead of walltime, couldn’t get (2)nanosleep to work, why I tell this in this context? - cause one really need to focus on thing at a time =) Do tiny steps to progress to end up with less mess. Uh, and either write it down if you succeded or have your code/recipes well placed, like snippets in your Editor/IDE. Losing so much time every day in searching/failing/redoing.
Software Development is complex nowadays - can’t have functionality without complexity.

Back in time, for my prototype, I used @JonnyD Tutorial - Thanks!!!

Alight, back to work!


Just a bit additional quick info:

Changing the target cpu/architecture/platform doesn’t help

Actually it was an deprecation and should be orange imo.
Means in this case it may or may not work - correct me if I am wrong. But old ABI is bad!


hey guys…

here are
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)



LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include $(LOCAL_PATH)/../SDL2_image/ $(LOCAL_PATH)/../SDL2_ttf/ $(LOCAL_PATH)/../SDL2_mixer/

# Add your application source files here...
LOCAL_SRC_FILES := main.cpp


LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog

LOCAL_CFLAGS := -std=gnu++11


# Uncomment this if you're using STL in your project
# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
APP_STL := stlport_static
#armeabi-v7a arm64-v8a x86 x86_64
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64

# Min runtime API level

just now i noticed a notificaition that says
“This file is not part of the project. Please include it in the appropriate file (build.gradle, CMakelists.txt or etc) and sync the project.”

i gues i need to add each file to

i will try it and get back to u



i know added .cpp files and header files to… god damnit, it seems i need to add each and every file to it,but i was able see that my source files are compiling,which is good i am now receiving some errors regarding to_string() and SDL_Log() is unidentified, i commented these two things and i was able to compile the project successfully, and i was able to install it on mobile… but running it throwed an error

Assertion failure at SDL_Getwindowsize_REAL

it seems i am using getwindowsize somewhere i need to verify how i am using it. get back to guys soon :slight_smile:

    05-05 16:43:42.341 474-2407/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
    05-05 16:43:42.564 28367-28386/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 28386 (SDLThread)
                                             [ 05-05 16:43:42.564   464:  464 W/         ]
                                             debuggerd: handling request: pid=28367 uid=10189 gid=10189 tid=28386
    05-05 16:43:42.633 28388-28388/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    05-05 16:43:42.633 28388-28388/? A/DEBUG: Build fingerprint: 'xiaomi/vince/vince:7.1.2/N2G47H/V9.5.4.0.NEGMIFA:user/release-keys'
    05-05 16:43:42.633 28388-28388/? A/DEBUG: Revision: '0'
    05-05 16:43:42.633 28388-28388/? A/DEBUG: ABI: 'arm'
    05-05 16:43:42.633 28388-28388/? A/DEBUG: pid: 28367, tid: 28386, name: SDLThread  >>> <<<
    05-05 16:43:42.633 28388-28388/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
    05-05 16:43:42.633 28388-28388/? A/DEBUG:     r0 00000000  r1 0000000a  r2 0000000a  r3 00000000
    05-05 16:43:42.634 28388-28388/? A/DEBUG:     r4 00000001  r5 cfc14cf4  r6 cfa85ef8  r7 cfc14c48
    05-05 16:43:42.634 28388-28388/? A/DEBUG:     r8 3acfba1d  r9 dcdf9e00  sl 00000000  fp cfc150ac
    05-05 16:43:42.634 28388-28388/? A/DEBUG:     ip e362ec5c  sp cfc14c1c  lr e362184b  pc cfd31fc0  cpsr 800f0030
    05-05 16:43:42.635 28388-28388/? A/DEBUG: backtrace:
    05-05 16:43:42.635 28388-28388/? A/DEBUG:     #00 pc 0001cfc0  /data/app/ (Mix_VolumeChunk+11)
    05-05 16:43:42.636 28388-28388/? A/DEBUG:     #01 pc 00013847  /data/app/ (_ZN20EAudioChunkComponent9SetVolumeEi+52)
    05-05 16:43:42.636 28388-28388/? A/DEBUG:     #02 pc 000137a3  /data/app/ (_ZN20EAudioChunkComponentC1ESsbib+170)
    05-05 16:43:42.636 28388-28388/? A/DEBUG:     #03 pc 00010d79  /data/app/ (_ZN10TestPlayerC1Ev+124)
    05-05 16:43:42.636 28388-28388/? A/DEBUG:     #04 pc 0000fdd1  /data/app/ (_ZN9TestSceneC1ESs+100)
    05-05 16:43:42.636 28388-28388/? A/DEBUG:     #05 pc 0000fd19  /data/app/ (_ZN15TestApplication9LoadSceneEv+72)
    05-05 16:43:42.636 28388-28388/? A/DEBUG:     #06 pc 0000f047  /data/app/ (SDL_main+138)
    05-05 16:43:42.636 28388-28388/? A/DEBUG:     #07 pc 0002c1c7  /data/app/ (Java_org_libsdl_app_SDLActivity_nativeRunMain+630)
    05-05 16:43:42.636 28388-28388/? A/DEBUG:     #08 pc 0000e5e5  /data/app/ (offset 0xe000)
    05-05 16:43:43.357 558-558/? E/lowmemorykiller: Error writing /proc/28367/oom_score_adj; errno=22
    05-05 16:43:43.372 1522-1664/? E/InputDispatcher: channel '9b93a47 (server)' ~ Channel is unrecoverably broken and will be disposed!

i am getting following issue now, it something related to the sdl_mixer. has anyone faced it?



I started using this a few weeks ago and it is great,