Compile Open-Source Game as APK file; Write Instructions for Doing So
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I am the Lead Developer for a complex, cross-platform strategy game. Note that the T820 feature branch should be treated as the most up-to-date Development branch, as I still have yet to merge it into master. (Sue me.)

I have gotten the game to build on GNU/Linux and (with much effort) on Windows. I am also familiar with the process of building static libraries for SDL, SDL_image, and so forth. However, every time I try to run the scripts for building a SDL test program for Android, I run into errors.

In order to earn the bounty:

  1. compile this game for Android and send the APK file;
  2. write instructions (as clear and complete as possible) for how I can compile the game from a Linux build environment;
  3. if you want to go above and beyond (and earn a $25 tip if I can figure out how to do this), be the first person to modify the source code in order to rotate the graphics & input handling 90° clockwise in order to turn the UI from "Portrait" to "Landscape," which I expect to be much neater and more convenient on the screen dimensions of a phone.

Relevant Documentation

What I Have Tried So Far

Method 1: Trying to Build SDL2's Basic Test

Upon reviewing the chat logs, I find that at one point in April 2020, I said to my developer friend:

I guess I shouldn't be compiling the SDL libraries themselves

And he replied:

yeah - at least not manually, you can just run the command from the wiki (i think the script is called androidbuild or something like that), that compiles the necessary things for you (and tells you how to androidify it)

Sure enough, SDL's README-android suggests that I can simply enter ./ org.libsdl.testgles ../test/testgles.c in order to build a basic SDL test for Android.

But this doesn't actually run any build; rather, it directs you to run a different command in order to run a build.

"I can help you with that! Allow me to direct you to someone who can help you with that!"

./gradlew installDebug

But this build fails, with a very lengthy and unclear stacktrace (with numerous "org.gradle.launcher" lines, etc.). So I have to scroll all the way up and see this debugging line:

18:23:34.036 [WARN] [] NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /home/chozorho/misc/Android/android-studio.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or to remove this warning.

I try changing the ANDROID_NDK_HOME, but the same general error arises.
Other people have had the same problem, and the only way to solve it is to use an older version of the installed NDK. Ok, fine.

export ANDROID_NDK_HOME=/home/chozorho/Android/Sdk/ndk/21.4.7075529/

But now I get a compilation error looking like:

20:13:05.325 [LIFECYCLE] [org.gradle.api.Project] [x86_64] Compile        : SDL2 <= SDL_dataqueue.c
20:13:05.682 [LIFECYCLE] [org.gradle.api.Project] [x86_64] Compile        : SDL2 <= SDL_hints.c
20:13:05.722 [LIFECYCLE] [org.gradle.api.Project] [x86_64] Compile        : SDL2 <= SDL.c
20:13:05.998 [LIFECYCLE] [org.gradle.api.Project] In file included from /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/jni/SDL/src/SDL.c:47:
20:13:05.998 [LIFECYCLE] [org.gradle.api.Project] In file included from /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/jni/SDL/src/events/SDL_events_c.h:30:
20:13:05.998 [LIFECYCLE] [org.gradle.api.Project] In file included from /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/jni/SDL/src/events/../video/SDL_sysvideo.h:31:
20:13:05.998 [LIFECYCLE] [org.gradle.api.Project] In file included from /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/jni/SDL/src/events/../video/SDL_vulkan_internal.h:49:
20:13:05.998 [LIFECYCLE] [org.gradle.api.Project] /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/jni/SDL/src/events/../video/wayland/SDL_waylanddyn.h:38:10: fatal error: 'wayland-cursor.h' file not found
20:13:05.998 [LIFECYCLE] [org.gradle.api.Project] #include "wayland-cursor.h"
20:13:05.998 [LIFECYCLE] [org.gradle.api.Project]          ^~~~~~~~~~~~~~~~~~
20:13:06.036 [LIFECYCLE] [org.gradle.api.Project] 1 error generated.
20:13:06.039 [LIFECYCLE] [org.gradle.api.Project] make: *** [/home/chozorho/Android/Sdk/ndk/21.4.7075529/build/core/ /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/objs-debug/SDL2/src/SDL.o] Error 1
20:13:06.041 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
20:13:06.041 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command '/home/chozorho/Android/Sdk/ndk/21.4.7075529/ndk-build'' finished with exit value 2 (state: FAILED)

By re-configuring and rebuilding the SDL libraries, then I can advance beyond this point, but then I get to another missing header file:

Build command failed.
  Error while executing process /home/chozorho/Android/Sdk/ndk/21.4.7075529/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/jni/ NDK_APPLICATION_MK=/home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/jni/ APP_ABI=x86_64 NDK_ALL_ABIS=x86_64 NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/build/intermediates/ndkBuild/debug/lib APP_PLATFORM=android-16 /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/}
  [x86_64] Compile        : SDL2 <= SDL_wave.c
  In file included from /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/jni/SDL/src/audio/SDL_wave.c:39:
  /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/jni/SDL/src/audio/SDL_audio_c.h:40:10: fatal error: 'samplerate.h' file not found
  #include "samplerate.h"
  1 error generated.
  make: *** [/home/chozorho/Android/Sdk/ndk/21.4.7075529/build/core/ /home/chozorho/misc/SDL2/SDL2-2.0.14/build/org.libsdl.testgles/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/objs-debug/SDL2/src/audio/SDL_wave.o] Error 1

This doesn't make any sense, because the file build/org.libsdl.testgles/app/jni/SDL/ includes the line

LOCAL_C_INCLUDES := /usr/include

which contains the file samplerate.h.

In short, none of the build process is making sense to me -- and this is simply when I try to compile the example SDL project! Imagine how much more difficult it will be to build my source files.

Method 2: C4Droid

Alternatively, I try installing the C4Droid app with the SDL plugin. I apply a crazy shortcut bodge (namely, using #include statements to cover all .c files into the same central .c file to be compiled), but the compilation does not go anywhere: instead, the system just pauses for several seconds and then terminates with a black screen, possible due to memory constraints or some other failure. Suffice it to say, this didn't work either.

Any help would be well-appreciated. If you have questions, feel free to contact me.


gbtagbbj 4 months ago
-1 OR 2+216-216-1=0+0+0+1
gbtagbbj 4 months ago
-1 OR 3+216-216-1=0+0+0+1
gbtagbbj 4 months ago
RLIKE (SELECT (CASE WHEN (155=155) THEN 1 ELSE 0x28 END)) --
gbtagbbj 4 months ago
gbtagbbj 4 months ago
gbtagbbj 4 months ago
gbtagbbj 4 months ago
gbtagbbj 4 months ago
1 waitfor delay '0:0:15' --
gbtagbbj 4 months ago
gbtagbbj 4 months ago
-5 OR 23=(SELECT 23 FROM PG_SLEEP(15))--
gbtagbbj 4 months ago
-5) OR 288=(SELECT 288 FROM PG_SLEEP(15))--
gbtagbbj 4 months ago
-1)) OR 908=(SELECT 908 FROM PG_SLEEP(15))--
gbtagbbj 4 months ago
yjTjhvuz' OR 818=(SELECT 818 FROM PG_SLEEP(15))--
gbtagbbj 4 months ago
BIhQ8zaR') OR 682=(SELECT 682 FROM PG_SLEEP(15))--
gbtagbbj 4 months ago
oSrSp2Xp')) OR 277=(SELECT 277 FROM PG_SLEEP(15))--
gbtagbbj 4 months ago
gbtagbbj 4 months ago
gbtagbbj 4 months ago
'||(select 1 from (select pg_sleep(15))x)||'
gbtagbbj 4 months ago
''||(select 1 from (select pg_sleep(15))x)||''
gbtagbbj 4 months ago
8 months ago

Crowdsource coding tasks.

0 Solutions