From e27fb466722f21d5edfa8b2eb72c240bb7723c05 Mon Sep 17 00:00:00 2001 From: garan Date: Thu, 9 Oct 2025 11:41:38 +0100 Subject: [PATCH 1/4] Adds example --- watchface/README.md | 24 +++++++++++++++++-- .../pack-java/.cargo-example/config.toml | 16 +++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 watchface/pack-java/.cargo-example/config.toml diff --git a/watchface/README.md b/watchface/README.md index cf9bbc14..696a70a2 100644 --- a/watchface/README.md +++ b/watchface/README.md @@ -20,5 +20,25 @@ example, using `pngquant` on all images, to help keep the watch face size to a m ## Packaging the watch face To package the watch face, the [Pack](https://github.com/google/pack) is used. This is a native -library, so the pre-builts are provided in `jniLibs`. A script is also included for building these -fresh, but that should not be necessary. \ No newline at end of file +library, so the pre-builts are provided in `jniLibs`. + +## Building native libraries + +A script is also included for building these fresh, but that is generally not necessary when +building Androidify. + +However, if you do wish to build these, the follow these steps in order to run the script: + +1. [Install][install-ndk] the Android NDK. +2. [Install][install-rust] Rust and Cargo. +3. Make a copy of `Androidify/watchface/pack-java/.cargo-example` as + `Androidify/watchface/pack-java/.cargo`. +4. Open `Androidify/watchface/pack-java/.cargo/config.toml`. +5. Adjust all the `linker` and `ar` paths, replacing `/Your/Path/To` with the paths to your NDK + binaries. Note that each linker must support API level 26 and above, to match the Androidify + `minSdk`. For example: `armv7a-linux-androideabi26-clang`. +6. Execute the `./provide-libraries-to-androidify-project.sh` script. This will build the native + libraries and copy them to the `jniLibs` directory. + +[install-ndk]: https://developer.android.com/studio/projects/install-ndk#default-version +[install-rust]: https://rust-lang.org/tools/install/ \ No newline at end of file diff --git a/watchface/pack-java/.cargo-example/config.toml b/watchface/pack-java/.cargo-example/config.toml new file mode 100644 index 00000000..aa828a3f --- /dev/null +++ b/watchface/pack-java/.cargo-example/config.toml @@ -0,0 +1,16 @@ +# Real watch +[target.armv7-linux-androideabi] +linker = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi26-clang" +ar = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" +# Emulator +[target.i686-linux-android] +linker = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android26-clang" +ar = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" +# Emulator on Apple Silicon MacBooks +[target.aarch64-linux-android] +linker = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android26-clang" +ar = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" +# Emulator (64-bit x86_64) +[target.x86_64-linux-android] +linker = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android26-clang" +ar = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" \ No newline at end of file From 38e24b72452979e998f7cfe5529c947389fb630d Mon Sep 17 00:00:00 2001 From: garan Date: Thu, 9 Oct 2025 11:48:48 +0100 Subject: [PATCH 2/4] Fixes typo --- watchface/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/watchface/README.md b/watchface/README.md index 696a70a2..ae7c933e 100644 --- a/watchface/README.md +++ b/watchface/README.md @@ -27,7 +27,7 @@ library, so the pre-builts are provided in `jniLibs`. A script is also included for building these fresh, but that is generally not necessary when building Androidify. -However, if you do wish to build these, the follow these steps in order to run the script: +However, if you do wish to build these, follow these steps in order to run the script: 1. [Install][install-ndk] the Android NDK. 2. [Install][install-rust] Rust and Cargo. From 72e6e6b2783a84dd1ce016b1039dc2d4b5a2458d Mon Sep 17 00:00:00 2001 From: garanj Date: Thu, 9 Oct 2025 11:49:54 +0100 Subject: [PATCH 3/4] Update watchface/pack-java/.cargo-example/config.toml Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- .../pack-java/.cargo-example/config.toml | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/watchface/pack-java/.cargo-example/config.toml b/watchface/pack-java/.cargo-example/config.toml index aa828a3f..d05fcc70 100644 --- a/watchface/pack-java/.cargo-example/config.toml +++ b/watchface/pack-java/.cargo-example/config.toml @@ -1,16 +1,20 @@ +# The paths below are examples for a macOS (darwin-x86_64) host. +# You will need to adjust them for your operating system and NDK installation. +# Replace with the absolute path to your Android NDK installation. + # Real watch [target.armv7-linux-androideabi] -linker = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi26-clang" -ar = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" +linker = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi26-clang" +ar = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" # Emulator [target.i686-linux-android] -linker = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android26-clang" -ar = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" +linker = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android26-clang" +ar = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" # Emulator on Apple Silicon MacBooks [target.aarch64-linux-android] -linker = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android26-clang" -ar = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" +linker = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android26-clang" +ar = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" # Emulator (64-bit x86_64) [target.x86_64-linux-android] -linker = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android26-clang" -ar = "/Your/Path/To/Android/sdk/ndk/29.0.13846066/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" \ No newline at end of file +linker = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android26-clang" +ar = "/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar" \ No newline at end of file From 0763d0f8297748041ced45d5264d4d64a6ef558c Mon Sep 17 00:00:00 2001 From: garanj Date: Thu, 9 Oct 2025 11:50:03 +0100 Subject: [PATCH 4/4] Update watchface/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- watchface/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/watchface/README.md b/watchface/README.md index ae7c933e..642630f4 100644 --- a/watchface/README.md +++ b/watchface/README.md @@ -31,13 +31,13 @@ However, if you do wish to build these, follow these steps in order to run the s 1. [Install][install-ndk] the Android NDK. 2. [Install][install-rust] Rust and Cargo. -3. Make a copy of `Androidify/watchface/pack-java/.cargo-example` as - `Androidify/watchface/pack-java/.cargo`. -4. Open `Androidify/watchface/pack-java/.cargo/config.toml`. -5. Adjust all the `linker` and `ar` paths, replacing `/Your/Path/To` with the paths to your NDK - binaries. Note that each linker must support API level 26 and above, to match the Androidify - `minSdk`. For example: `armv7a-linux-androideabi26-clang`. -6. Execute the `./provide-libraries-to-androidify-project.sh` script. This will build the native +3. Make a copy of `watchface/pack-java/.cargo-example` as + `watchface/pack-java/.cargo`. +4. Open `watchface/pack-java/.cargo/config.toml`. +5. Adjust all the `linker` and `ar` paths, replacing `` with the absolute path to your + Android NDK installation. Note that each linker must support API level 26 and above, to match + the Androidify `minSdk`. For example: `armv7a-linux-androideabi26-clang`. +6. Execute the `watchface/provide-libraries-to-androidify-project.sh` script. This will build the native libraries and copy them to the `jniLibs` directory. [install-ndk]: https://developer.android.com/studio/projects/install-ndk#default-version