Skip to content

Commit 02ad25c

Browse files
authored
Merge pull request #158 from garanj/watchface-libs-example
Adds example of building Pack
2 parents 6774068 + 0763d0f commit 02ad25c

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

watchface/README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,25 @@ example, using `pngquant` on all images, to help keep the watch face size to a m
2020
## Packaging the watch face
2121

2222
To package the watch face, the [Pack](https://github.com/google/pack) is used. This is a native
23-
library, so the pre-builts are provided in `jniLibs`. A script is also included for building these
24-
fresh, but that should not be necessary.
23+
library, so the pre-builts are provided in `jniLibs`.
24+
25+
## Building native libraries
26+
27+
A script is also included for building these fresh, but that is generally not necessary when
28+
building Androidify.
29+
30+
However, if you do wish to build these, follow these steps in order to run the script:
31+
32+
1. [Install][install-ndk] the Android NDK.
33+
2. [Install][install-rust] Rust and Cargo.
34+
3. Make a copy of `watchface/pack-java/.cargo-example` as
35+
`watchface/pack-java/.cargo`.
36+
4. Open `watchface/pack-java/.cargo/config.toml`.
37+
5. Adjust all the `linker` and `ar` paths, replacing `<NDK_PATH>` with the absolute path to your
38+
Android NDK installation. Note that each linker must support API level 26 and above, to match
39+
the Androidify `minSdk`. For example: `armv7a-linux-androideabi26-clang`.
40+
6. Execute the `watchface/provide-libraries-to-androidify-project.sh` script. This will build the native
41+
libraries and copy them to the `jniLibs` directory.
42+
43+
[install-ndk]: https://developer.android.com/studio/projects/install-ndk#default-version
44+
[install-rust]: https://rust-lang.org/tools/install/
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# The paths below are examples for a macOS (darwin-x86_64) host.
2+
# You will need to adjust them for your operating system and NDK installation.
3+
# Replace <NDK_PATH> with the absolute path to your Android NDK installation.
4+
5+
# Real watch
6+
[target.armv7-linux-androideabi]
7+
linker = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi26-clang"
8+
ar = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"
9+
# Emulator
10+
[target.i686-linux-android]
11+
linker = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android26-clang"
12+
ar = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"
13+
# Emulator on Apple Silicon MacBooks
14+
[target.aarch64-linux-android]
15+
linker = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android26-clang"
16+
ar = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"
17+
# Emulator (64-bit x86_64)
18+
[target.x86_64-linux-android]
19+
linker = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android26-clang"
20+
ar = "<NDK_PATH>/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"

0 commit comments

Comments
 (0)