Repository navigation
Compiler Option App
Home › Compiler Option: -app
Build an Android app (an APK, or an App Bundle for Play) of an SDL3 program
Experimental. Android support is new and still settling: these options and how tkControls behaves on a phone may still change. See Android.
Syntax
-app [ -appid id ] [ -applabel text ] [ -appversion name[,code] ] [ -appicon file.png ] [ -appassets dir ] [ -apppermission name ]... [ -appkey keystore[,alias] ] [ -appbundle ]
Parameters
| Option | |
|---|---|
-appid id |
the application id, two or more dot-separated names (org.example.game); default org.tiko.<name>
|
-applabel text |
the name shown under the app's icon; default the program's name |
-appversion name[,code] |
the version name a user sees and the version code Android compares, a whole number from 1 to 2100000000; default 1.0,1
|
-appicon file.png |
the launcher icon; default Android's own |
-apppermission name |
a permission the app uses, one <uses-permission> in the manifest; repeatable. A name with no dot is android.permission.<name>, so -apppermission INTERNET is what any network use (sockets, HTTP) needs. Default none |
-appassets dir |
a directory whose files, subdirectories included, become the app's assets |
-appkey keystore[,alias] |
sign with this key rather than the debug key. Its passwords are read from the environment variables TIKO_ANDROID_KS_PASS and TIKO_ANDROID_KEY_PASS (the key's, when it differs), never from the command line. -appbundle needs the alias |
-appbundle |
write an Android App Bundle (.aab), what Google Play takes, rather than an .apk
|
Description
-app builds the program for -target android-x86_64 or -target android-arm64 as an Android app: a shared library that SDL3's Java side loads and runs, packaged with the Android SDK's tools and signed. The output is <name>.apk, or <name>.aab with -appbundle. Any other target is refused with TKO0195, and an -app* option without -app with TKO0197.
The program must import vendor/SDL3, directly or through a package such as tkControls. Its print output goes to the device's log (adb logcat -s tiko); its exepath is "."; its working directory is the app's private storage; and a read-only open (or std/fs read) of a relative name that is not a file there reads the app's asset of that name.
Needed besides the toolchain: the Android NDK (ANDROID_NDK_HOME), the SDK's build-tools and platform 36 (ANDROID_HOME), and a JDK 17 or newer (JAVA_HOME); for -appbundle, bundletool (TIKO_ANDROID_BUNDLETOOL, or bundletool*.jar in a bundletool folder beside the SDK).
In a project, kind = "app" in [target.<name>] builds the target with -app, and a [target.<name>.app] table sets the others: id, label, version, icon, assets, key, permissions (an array: permissions = ["INTERNET"]) and bundle = true.
Examples
tiko -target android-arm64 -app game.tiko
tiko -target android-arm64 -app -appbundle -appid org.example.game -appversion 1.0,1 -appkey release.jks,upload game.tiko
Differences from FB
- New to tiko. fbc's
-target androidbuilds a program, not an app.
See also
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Home
- What Is tiko-lang
- Quick Start
- Installing on macOS
- Android (experimental)
- Debugging
- Feature Index
- Compatibility
- FAQ
- AI Cheatsheet
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Match
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Array Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Time Zones
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- tiko test
- tiko doc
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing