Browse Source

Add Android notes

master
Macoy Madson 3 years ago
parent
commit
1b3b68654b
  1. 48
      ReadMe.org

48
ReadMe.org

@ -39,3 +39,51 @@ V has a OnePlus 6T Android phone with the following specifications (from [[https
| Android Version | 10 |
The two main specs I need to care about are Android Version and Display Resolution. Additionally, AMOLED hints that pure black is going to look nice.
* Setup
** Android
See [[file:Dependencies/gamelib/Dependencies/SDL/docs/README-android.md][SDL's README-android.md]] for instructions I followed for setting up Android. You need to download Android Studio. (You could get away with only the SDK and build tools, but you'll probably want the debugger when things don't work out of the box anyways.)
*** Known working version(s)
My local build was tested the following software versions:
| Component | Version |
|-----------------+---------------|
| Android | 10 |
| SDK Build-Tools | 29.03, 28.03¹ |
| NDK | 21.4.7075529² |
¹= I'm not actually sure which SDK version is being used, because I didn't explicitly specify one.
²= I had to downgrade from version 22 due to ~platforms~ folder missing. See below section.
*** Fix ~SDL_main()~ not found in ~libmain.so~ error
- Ensure you have ~main()~ defined *with* its full signature: ~int main(int numArgs, char* args[])~
- Note that SDL defines ~main()~ as a macro to be ~SDL_main()~, which is a bit confusing, but works okay as long as you have the full signature
*** Fix no ~platforms~ folder in NDK
I had to downgrade from version 22 due to ~platforms~ folder missing. To do so:
- Open Android Studio
- ~Tools -> SDK Manager~
- Switch to tab ~SDK Tools~
- Check ~Show Package Details~
- Expand the NDK tree and check ~21.4.7075529~, then click OK
*** Building from the command line
Follow the [[file:Dependencies/gamelib/Dependencies/SDL/docs/README-android.md][SDL README-android.md]] for using ~androidbuild.sh~, which is how I got the first version going. For reference, here is the command sequence:
#+BEGIN_SRC sh
cd Dependencies/gamelib/Dependencies/SDL/build-scripts
export ANDROID_HOME=/home/macoy/Android/Sdk
export ANDROID_NDK_HOME=/home/macoy/Android/Sdk/ndk/21.4.7075529/
./androidbuild.sh org.libsdl.testgles ../test/testgles.c
cd ../build/org.libsdl.testgles
# Note: This will only succeed if you have an Android device plugged in to USB, with Developer mode enabled
./gradlew installDebug
#+END_SRC
All I had to do for my project was copy some files as the Readme instructs, then edit ~SDL/build/org.libsdl.testgles/app/jni/src/Android.mk~, to add the files and flags, e.g.:
#+BEGIN_SRC makefile
# Work around "bug" in cakelisp where there are extraneous parens
LOCAL_CFLAGS += -Wno-parentheses-equality
# Copied straight from cakelisp_cache
LOCAL_SRC_FILES := Main.cake.cpp Math.cake.cpp SDL.cake.cpp
#+END_SRC
*** Fix Android Studio not knowing how to build/debug project
Click ~File -> Sync Project files with Gradle files~.

Loading…
Cancel
Save