{"id":16842564,"url":"https://github.com/rofl0r/sdl2-android19-tutorial","last_synced_at":"2025-07-21T08:34:49.931Z","repository":{"id":138311898,"uuid":"334265263","full_name":"rofl0r/sdl2-android19-tutorial","owner":"rofl0r","description":"a tutorial how to build a hello world SDL2 for android API level 19 with ndk r16b and ant.","archived":false,"fork":false,"pushed_at":"2021-01-29T21:23:19.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-18T00:43:19.987Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rofl0r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-29T21:19:05.000Z","updated_at":"2021-01-30T06:21:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"d33f296a-1b19-4ab3-b709-781acd5d3c14","html_url":"https://github.com/rofl0r/sdl2-android19-tutorial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rofl0r/sdl2-android19-tutorial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fsdl2-android19-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fsdl2-android19-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fsdl2-android19-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fsdl2-android19-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rofl0r","download_url":"https://codeload.github.com/rofl0r/sdl2-android19-tutorial/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fsdl2-android19-tutorial/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266267474,"owners_count":23902371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T12:46:45.312Z","updated_at":"2025-07-21T08:34:49.906Z","avatar_url":"https://github.com/rofl0r.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"how to produce an SDL2 app running on android API level 19\n----------------------------------------------------------\n\nfirst we clone SDL repo:\n\n    cd ~\n    git clone https://github.com/libsdl-org/SDL \u0026\u0026 cd SDL\n\ncheckout the commit that was on top of \"main\" branch at that time of this\nwriting:\n\n    git checkout 8e1005f8b00c0ef7d015e20ae9e88eb6bef41242\n\nwe copy android-project-ant directory outside the SDL tree with a new name\n\n    cp -r android-project-ant ~/android-hello\n    cd ~/android-hello\n\ninside the new source tree are 2 symlinks which now point into nirvana:\n\n    AndroidManifest.xml -\u003e ../android-project/app/src/main/AndroidManifest.xml\n\nin case of AndroidManifest.xml, we remove the symlink and replace it with\nthe contents of that file in the SDL repo:\n\n    rm -f AndroidManifest.xml\n    cp ~/SDL/android-project/app/src/main/AndroidManifest.xml .\n\nthe second symlink is:\n\n    src -\u003e ../android-project/app/src/main/java\n\nwe remove it, and point it to the right path inside SDL dir.\n\n    rm -f src\n    ln -s ~/SDL/android-project/app/src/main/java src\n\nadditionally, the entire sourcecode of SDL is expected to live in jni/SDL.\nwe symlink the git repo there:\n\n    cd jni\n    ln -s ~/SDL SDL\n\nnext thing we need is a \"hello world\" application, find it in this repo,\nit's main.c, also required is sdl2-bmp.h, put both files into jni/src.\n\nadditionally we need to patch some files we copied from SDL, get sdl2.patch\nfrom this repo and run\n\n    cd ~/android-hello\n    patch -p1 \u003c sdl2.patch\n\ncurrent SDL2 repo is utterly broken for any android API \u003c 26, so we need\nto cd into the SDL repo and check out the latest commit that wasn't broken:\n\n    cd ~/SDL\n    git checkout 03ff7dcf6~1\n\n\nalright, the SDL source and repo is now ready to go, next we need to install\na toolchain.\n\nrun install-toolchain.sh from this repo. it assumes an ubuntu install.\n\n    sh install-toolchain.sh\n\n( i used it as regular user on an ubuntu 20.04 rootfs like this:\n  https://github.com/sabotage-linux/sabotage/wiki/Running-a-minimal-ubuntu-rootfs-as-regular-user )\n\nthis sets up the toolchain in /opt.\n\ngo back to android-hello:\n\n    cd ~/android-hello\n\nwhenever we need to compile something for android, we need to set up an\nenvironment so the toolchain is found.\n\ncopy android-env.sh from this repo into your ~/android-hello directory and\nsource it into your shell before building:\n\n    source android-env.sh\n\nnow you can build the C part of the code via:\n\n    ndk-build V=1\n\nand the java part like this:\n\n    ant debug\n\nor\n\n    ant release\n\nto create a debug or release apk respectively.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fsdl2-android19-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frofl0r%2Fsdl2-android19-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fsdl2-android19-tutorial/lists"}