Skip to content

Commit 1375d13

Browse files
authored
Merge pull request #2542 from je-l/clibuild
Add a third build option: CLI Build
2 parents c1fedcb + a5ad946 commit 1375d13

7 files changed

Lines changed: 93 additions & 10 deletions

File tree

docs/EN/Maintenance/DocumentationUpdate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Docs updates & changes
22

3+
## March 2026
4+
5+
- [Add CLI Build option](../SettingUpAaps/CLIBuild.md) @je-l
6+
- Rename *Computer Build* to *Android Studio Build*. Preserve file names for URLs.
7+
38
## January 2025
49

510
- [3.4](#version3400) release and documentation update roll-up (Wizard, Computer build versions, Config Builder)

docs/EN/Maintenance/UpdateComputerBuild.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Update with a computer
1+
# Update with Android Studio
22

33
## Build yourself instead of download
44

@@ -8,7 +8,7 @@
88
In case you want to build **AAPS** on a new computer : copy your back-up keystore file to the new computer. Then follow the [Initial build **AAPS** procedure](../SettingUpAaps/BuildingAaps.md) instead of this guide. With the only difference that instead of creating a new keystore, you can select the one you have copied on the new computer.
99
```
1010

11-
## Overview for updating to a new version of AAPS with a computer
11+
## Overview for updating to a new version of AAPS with Android Studio
1212

1313
```{contents} Steps for updating to a new version of AAPS
1414
:depth: 1

docs/EN/Maintenance/UpdateToNewVersion.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515

1616
If you already built your AAPS app with the Browser Build method, follow [these instructions](./UpdateBrowserBuild.md).
1717

18-
## Update AAPS with a computer
18+
## Update AAPS with Android Studio
1919

2020
Follow [these instructions.](./UpdateComputerBuild.md).
2121

22+
## Update AAPS with the command-line
23+
24+
Use the [same instructions](../SettingUpAaps/CLIBuild.md) as when building AAPS previously, but pull new changes with git.
25+
2226
(Update-to-new-version-check-aaps-version-on-phone)=
2327
### Check AAPS version on phone
2428

docs/EN/SettingUpAaps/BuildingAaps.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,27 @@ See [FAQ page](../UsefulLinks/FAQ.md) for details.
88

99
---
1010

11-
Two methods are available to build the AAPS app:
11+
Three methods are available to build the AAPS app:
1212

13-
### Build with a browser
13+
### Build with a browser (recommended)
1414

1515
You can build the app with your smartphone using GitHub actions, and save it in your Google Drive.
1616

1717
**[Follow these instructions.](./BrowserBuild.md)**
1818

1919
----
2020

21-
### Build with a computer
21+
### Build with Android Studio
2222

23-
You can build the app with your computer using Android Studio.
23+
You can build the app with your computer using Android Studio. This used to be the only build option,
24+
nowadays Android Studio is mostly used by developers who consider making code changes.
2425

2526
**[Follow these instructions.](./ComputerBuild.md)**
2627

28+
----
29+
30+
### Build using the command-line
31+
32+
This option is intended for those who prefer to build AAPS in local command-line, without installing Android Studio.
33+
34+
**[Follow these instructions.](./CLIBuild.md)**

docs/EN/SettingUpAaps/CLIBuild.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Build instructions for the command-line
2+
3+
```{admonition} For users familiar with the command-line and git
4+
:class: information
5+
6+
The simplest option to build AAPS is the [Browser build](./BrowserBuild.md) alternative.
7+
```
8+
9+
Tested with Fedora and Debian Linux, other systems should work with minimal adjustments.
10+
11+
## Requirements
12+
13+
Consult the minimum required Java version from [this table](#Building-APK-recommended-specification-of-computer-for-building-apk-file).
14+
Install the appropriate OpenJDK package using the system package manager.
15+
For example in Debian, the packages are named like `openjdk-21-jdk`. It should include `javac` and `keytool` binaries.
16+
17+
Download the *Android Command line tools* package from the [Android Studio page](https://developer.android.com/studio#command-line-tools-only).
18+
Android Studio itself is not required.
19+
More information about installing this package is found in [sdkmanager docs](https://developer.android.com/tools/sdkmanager).
20+
After the package is installed, you should manually set two [environment variables](https://developer.android.com/tools/variables): `ANDROID_HOME` and `PATH`.
21+
Finally, run `sdkmanager --licenses` to finish the installation.
22+
23+
## Building AAPS with Gradle wrapper
24+
25+
### 1. Generate a Java keystore file for signing AAPS
26+
27+
If you already have a keystore file for signing AAPS, reuse that.
28+
29+
```sh
30+
keytool -genkeypair -v \
31+
-keystore aaps-keystore.jks \
32+
-alias aaps-key \
33+
-keyalg RSA \
34+
-keysize 4096 \
35+
-validity 20000
36+
```
37+
38+
You will need the keystore file and passphrase every time you update AAPS.
39+
40+
### 2. Compile the AAPS APK file
41+
42+
Clone the [git repo](https://github.com/nightscout/AndroidAPS) if not already cloned.
43+
AAPS uses master branch for the latest stable version, ensure you are on the branch/tag you want to build.
44+
45+
Run `./gradlew :app:assembleFullRelease` in the repo. It automatically downloads Gradle, dependencies, and then compiles the code.
46+
When the build succeeds, you should have an unsigned APK at `app/build/outputs/apk/full/release/app-full-release-unsigned.apk`.
47+
It should have also installed an `apksigner` binary to `$ANDROID_HOME`. Update your `PATH` again.
48+
49+
### 3. Create a signed APK file from the unsigned one
50+
51+
<!-- Suggest building outside the git repo, to minimize risk of accidental APK commits -->
52+
53+
Change to your home directory and create a signed APK file:
54+
55+
```sh
56+
apksigner sign \
57+
--ks path/to/aaps-keystore.jks \
58+
--ks-key-alias aaps-key \
59+
--out app-full-release-signed.apk \
60+
./AndroidAPS/app/build/outputs/apk/full/release/app-full-release-unsigned.apk
61+
```
62+
63+
Now you have `app-full-release-signed.apk` ready for installation or upgrade.

docs/EN/SettingUpAaps/ComputerBuild.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Computer Build
1+
<!-- Android Studio Build, FKA Computer Build. Preserve filenames to avoid breaking URLs. -->
2+
3+
# Android Studio Build
24

35
This is the traditional method to build your AAPS app.
46

docs/EN/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ Setting up the reporting server <./SettingUpAaps/SettingUpTheReportingServer.md>
9393
- Tidepool <./SettingUpAaps/Tidepool.md>
9494
Building AAPS <./SettingUpAaps/BuildingAaps.md>
9595
- Browser Build <./SettingUpAaps/BrowserBuild.md>
96-
- Computer Build <./SettingUpAaps/ComputerBuild.md>
96+
- Android Studio Build <./SettingUpAaps/ComputerBuild.md>
97+
- CLI Build <./SettingUpAaps/CLIBuild.md>
9798
Transferring and Installing AAPS <./SettingUpAaps/TransferringAndInstallingAaps.md>
9899
Setup Wizard <./SettingUpAaps/SetupWizard.md>
99100
Your AAPS Profile <./SettingUpAaps/YourAapsProfile.md>
@@ -151,7 +152,7 @@ AAPS Release Notes <./Maintenance/ReleaseNotes.md>
151152
Documentation updates <./Maintenance/DocumentationUpdate.md>
152153
Updating to a new version of AAPS <./Maintenance/UpdateToNewVersion.md>
153154
- Browser Update <./Maintenance/UpdateBrowserBuild.md>
154-
- Computer Update <./Maintenance/UpdateComputerBuild.md>
155+
- Android Studio Update <./Maintenance/UpdateComputerBuild.md>
155156
156157
```
157158

0 commit comments

Comments
 (0)