@@ -15,6 +15,10 @@ AABDIR = mobile/build/outputs/bundle
1515WEBUI_SRCDIR := aw-server-rust/aw-webui
1616WEBUI_DISTDIR := $(WEBUI_SRCDIR ) /dist
1717
18+ # NOTE: you have to download bundletool manually and set this path
19+ # https://github.com/google/bundletool/releases
20+ BUNDLETOOL := java -jar ~/Downloads/bundletool-all-1.15.5.jar
21+
1822# Main targets
1923all : aw-server-rust metadata
2024build : all
@@ -26,6 +30,27 @@ build-bundle: dist/aw-android.aab
2630# builds a complete, signed apk, puts it in dist
2731build-apk : dist/aw-android.apk
2832
33+ # Attempts at working with bundletool to build device-specific APKs
34+ # See: https://github.com/ActivityWatch/aw-android/issues/61
35+ dist/aw-android.apks :
36+ rm -rf dist/aw-android.apks
37+ $(BUNDLETOOL ) \
38+ build-apks --bundle=dist/aw-android.aab --output=dist/aw-android.apks
39+
40+ # Extracts device-specific APKs from the apks bundle
41+ build-device-specific-apks :
42+ # TODO: add arm(7), x86, x86_64
43+ $(BUNDLETOOL ) \
44+ extract-apks \
45+ --apks=dist/aw-android.apks \
46+ --output-dir=dist/splits/arm64 \
47+ --device-spec=scripts/device-arm64.json
48+
49+ # Useful for inspecting the contents of the apks
50+ unzip-apks : dist/aw-android.apks
51+ rm -rf dist/apks
52+ unzip -o dist/aw-android.apks -d dist/apks
53+
2954# builds debug and test apks (unsigned)
3055build-apk-debug : $(APKDIR ) /debug/mobile-debug.apk $(APKDIR ) /androidTest/debug/mobile-debug-androidTest.apk
3156 mkdir -p dist
0 commit comments