The minimum supported API version must be specified when building the native libraries, otherwise this may cause linking errors when launching the app.
The minimum API level is increased to 24 (Android 7.0, covering 97.2% of usages) because:
- Vulkan is only available from API 24+ on ARM64 and x64.
- curl only compiles with API 23+.
- The NDK version we use supports only API 21+.
Ensure that the C++/Linker flags are set when building Android libraries, which was causing errors due to `-fPIC` not being set for all libraries.
Gradle can determine the NDK version automatically and this property is only required if multiple NDK versions are installed. The NDK version previously determined from the filename could not be parsed by Gradle anyway.
Define shortcuts to launch the client with either Vulkan or OpenGL graphics backend, which can be accessed by long-pressing the app icon on the home screen. This feature is available for Android 7.1 and newer.
Abort the Android CMake build immediately if any of the command line arguments is not specified, instead of assuming default values.
Add more log messages for different build steps to improve progress reporting and improve the existing log messages.
Improve and fix colors of log messages. Previously, some log message colors were not terminated properly, causing the output color of subsequent commands to change.
Avoid some error messages when the build script is executed for the first time, i.e. when cleanup of the previous build is not necessary because the files do not exist yet.
Make some related variable names more readable by removing the unnecessary underscore and `DEFAULT` prefixes.
Abort the build script when the CMake build fails for any of the selected architectures. Previously, the build may have continued and caused an APK without the respective library files to be built.
Ensure that the main game library is copied successfully. Remove unnecessary copies of library files that do not exist and are unused, which were causing error messages during the build.
Parse `GAME_RELEASE_VERSION` and `DDNET_VERSION_NUMBER` definitions from `src/game/version.h` by default, so specifying a version manually is usually not necessary.
Use [cargo-ndk](https://github.com/bbqsrc/cargo-ndk) to configure cargo for building with the Android NDK. The output of `cargo ndk` is written to a subfolder for the target triplet, which cannot be changed by parameter. Therefore, the `CARGO_BUILD_DIR` is changed to this subfolder for the Android build, so the build process can find the output.
Use `$HOME` instead of `~` because cargo-ndk cannot correctly access the folder otherwise (will fail with error message indicating it could not determine the NDK version).
Add `DDNET_TEST_NO_LINK=ON` CMake argument, to fix Rust linking errors with tests.
Add additional CMake arguments to specify system name, API version and NDK location. Upgrade to Android API 34.
Use `nproc` instead of `32` threads for building.