Commit graph

26 commits

Author SHA1 Message Date
Robert Müller d9f810691b Remove duplicate dynamic loading of game library
SDL automatically loads the libraries specified in the array returned by the `getLibraries` method, so loading it manually is unnecessary. SDL also has additional error handling to quit the app with an appropriate error message popup if the library could not be loaded, which was not handled previously.
2024-05-23 20:47:18 +02:00
Robert Müller 41738f1880 Ensure libary is copied successfully, remove unnecessary copies
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.
2024-05-23 20:46:35 +02:00
Robert Müller d9686591f0 Ensure APK build type parameter is valid
Abort build script if the build type parameter value is not valid, instead of assuming the debug build.
2024-05-23 20:45:52 +02:00
Robert Müller e981d48b24 Extract build_gradle function, fix Gradle use without arguments
Extract `build_gradle` function to reduce duplicate code for running the Gradle build. Remove the initial invocation of Gradle without a build target, which has no effect and was causing an error message during the build.
2024-05-23 20:45:42 +02:00
Robert Müller 6a453d10b4 Remove unused _RELEASE_TYPE_APK_NAME variable
This variable is always empty.
2024-05-23 20:43:53 +02:00
Robert Müller 69102880c9 Remove unused GE_NO_APK_BUILD variable
This variable is always empty and we don't need to support not building the APK file.
2024-05-23 20:43:53 +02:00
ChillerDragon c75584406a Use shfmt as formatter for shell scripts 2024-05-23 08:05:00 +08:00
Robert Müller 1316ac3c70 Improve the Android building README.md 2024-05-21 17:38:48 +02:00
Robert Müller e4a7fd59f7 Determine default version name and code from version.h
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.
2024-05-21 17:38:48 +02:00
Robert Müller 51e4e41805 Change tw.DDNet package name to org.ddnet.client 2024-05-21 17:38:48 +02:00
Robert Müller 664b0e98bb Upgrade Gradle and fix Android deprecation errors
Upgrade to Gradle 8.5 and Gradle Plugin 8.3.0 for compatibility with Java 21. Explicity set Java version 21 in `build.gradle`. Increment compile and target SDK version to 34 accordingly.

Remove the explicitly defined, obsolete `buildToolsVersion` property in `build.gradle`, as it is now automatically derived by Gradle.

Replace the deprecated property `android:extractNativeLibs` in `AndroidMainfest.xml` with `useLegacyPackaging` in `build.gradle`.

Replace the deprecated package definition `package="tw.DDNet"` in `AndroidMainfest.xml` with `namespace("tw.DDNet")` in `build.gradle`.

Add the required property `android:exported="true"` to the main activity in `AndroidMainfest.xml`.
2024-05-21 17:38:42 +02:00
Robert Müller cdbe1f775a Various fixes/improvements to Android building scripts
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.
2024-05-21 17:36:47 +02:00
Robert Müller b2c2a74db7 Remove unused shell script function arguments
Only the first two arguments of the `build_for_type` and `copy_libs` functions are used.
2024-05-21 17:36:47 +02:00
Robert Müller ceb1640320 Fix incorrect CMake target name in cmake_android.sh
The name of the main target was changed from `DDNet` to `game-client`.
2024-05-21 17:36:46 +02:00
Robert Müller 468cd85839 Add build folder parameter to cmake_android.sh
Add a parameter instead of using the fixed build folder `build_android`.
2024-05-21 17:36:46 +02:00
Robert Müller ad9b44bfed Remove local.properties and add it to .gitignore
This file is not supposed to be added to version control and will be regenerated whenever the Gradle build is run.
2024-05-21 17:36:46 +02:00
Robert Müller 05c825947a Force landscape orientation and hide title bar on Android
Always force landscape orientation to be used for the game on Android.

Hide the title bar so it is not shown when starting the game. There is also a bug with SDL currently that leads to the title bar and status bar being shown permanently after minimizing and reopening the app, which is alleviated by hiding the title bar.
2024-05-19 12:58:33 +02:00
Rafael Fontenelle cd14660307 Fix misspellings 2022-10-25 13:51:56 -03:00
Jupeyy a22a8dce1c Fix Android build 2022-06-25 10:43:24 +02:00
Jupeyy bb1ed45c3d Emscripten support 2022-03-25 12:42:18 +01:00
Jupeyy e02ebca2c9 Rename lib generation scripts 2022-03-25 11:46:32 +01:00
Jupeyy fbeba9eb5f Add Vulkan backend 2022-03-21 12:39:51 +01:00
Jupeyy 55a1406641 Further android build fixes 2022-01-20 11:04:47 +01:00
Jupeyy 4bcddc8dae fix android curl cmake flags 2022-01-19 10:44:48 +01:00
def 052502a3d1 Fix local shellcheck warnings in android/files/build.sh
In ./scripts/android/files/build.sh line 3:
[ x"$1" == x ] && {
  ^---^ SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a purpose.

Did you mean:
[ "$1" == "" ] && {
2021-12-21 17:52:06 +01:00
Jupeyy b216b6744a Add Android build scripts 2021-08-24 12:18:20 +02:00