Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions watchface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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, 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 `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 `<NDK_PATH>` 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
[install-rust]: https://rust-lang.org/tools/install/
20 changes: 20 additions & 0 deletions watchface/pack-java/.cargo-example/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +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 <NDK_PATH> with the absolute path to your Android NDK installation.

# Real watch
[target.armv7-linux-androideabi]
linker = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi26-clang"
ar = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"
# Emulator
[target.i686-linux-android]
linker = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android26-clang"
ar = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"
# Emulator on Apple Silicon MacBooks
[target.aarch64-linux-android]
linker = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android26-clang"
ar = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"
# Emulator (64-bit x86_64)
[target.x86_64-linux-android]
linker = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android26-clang"
ar = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"