Android Studio Build

This is the traditional method to build your AAPS app.

You can build the app without a computer using the Browser Build method.

Постройте сами вместо скачивания

The AAPS app (an apk file) is not available for download, due to regulations around medical devices. Построить приложение для собственного использования вполне законно, но передавать копию другим не разрешается!

See FAQ page for details.


Технические характеристики компьютера и программного обеспечения для построения AAPS

  • A specific Android Studio version may be required to build the apk. See table below :

AAPS Version

Preferred
Android Studio
Version

Alternative
Android Studio
Version

Gradle

JVM

2.6.2

3.6.1

5.6.4

11

2.8.2.1

4.1.1

6.1.1

13

3.1.0.3

2020.3.1

tested up to Quail 4

7.3.3

17

3.2.0.4

Hedgehog (2023.1.1)

tested up to Quail 4

8.2

17

3.3.1.3

Ladybug Feature Drop (2024.2.2)

tested up to Quail 4

8.10

21

3.3.2

Meerkat (2024.3.1)

tested up to Quail 4

8.11.1

21

3.3.2.1

Narwhal (2025.1.2)

tested up to Quail 4

8.13

21

3.4.2.6

Panda 2 (2025.3.2)

tested up to Quail 4

9

21

4.0.0

Rabbit 2 (2026.2.2)

Latest

9.8

21

The «preferred version» is packaged with the appropriate JVM version. The preferred version is also the minimal version you can use to build AAPS. You will NOT be able to build on a version older than the «preferred» one. If using a different version, you may encounter issues related to JVM version. See the Troubleshooting Android Studio page to help solve these issues. If your current Android Studio version is not listed in the table, you must update it first.

The Gradle version is linked to the source code, you will always get the correct Gradle version when downloading / updating the source code. It is mentioned here for reference only, you don’t have to take action on it.

  • Windows 32-bit systems are not supported by Android Studio. Please keep in mind that both 64 bit CPU and 64 bit OS are mandatory condition. If your system DOES NOT meet this condition, you have to change affected hardware or software or the whole system.

OS (Only 64 bit) Windows 10 or higher macOS 12 or higher Any Linux distribution that supports Gnome, KDE, or Unity DE;  GNU C Library (glibc) 2.31 or later

CPU (Only 64 bit)

x86_64 CPU from 2017 or newer (Intel 8th generation Core i5, AMD Ryzen, or newer) with virtualization support (Intel VT-x or AMD-V) enabled in the BIOS Apple Silicon (M1 or newer), or 6th generation Intel Core or newer (support for Intel Macs is being phased out) x86_64 CPU from 2017 or newer (Intel 8th generation Core i5, AMD Ryzen, or newer) with virtualization support (Intel VT-x or AMD-V) enabled in the BIOS

RAM

16GB or more (8GB is the strict minimum for Android Studio alone, 32GB is recommended)

Disk

At least 32GB free space. SSD is recommended.

Resolution

1280 x 800 minimum (1920 x 1080 recommended)

Internet

Broadband

It is strongly recommended (not mandatory) to use SSD (Solid State Disk) instead of HDD (Hard Disk Drive) because it will take less time when you are building the AAPS apk file. You can still use a HDD when you are building the AAPS apk file. Процесс сборки приложения при этом может занять много времени, но после начала можно оставить его без присмотра.

Помощь и поддержка в процессе сборки

If you run into difficulties in the process of building the AAPS app, there is a dedicated troubleshooting Android Studio section, please consult that first.

If you think something in the building instructions is wrong, missing or confusing, or you are still struggling, please reach out to other AAPS users group on Facebook or Discord. If you want to change something yourself (updating screenshots etc), please submit a pull request (PR).

Пошаговое руководство по созданию приложения AAPS

WARNING

If you have built AAPS before, you don’t need to take all the following steps again. Please jump directly to the update guide!

In this guide you will find example screenshots of building of AAPS apk file. Because Android Studio - the software which we use to build the AAPS apk - is regularly updated, these screenshots may not be identical to your installation, but they should still be possible to follow.

Since Android Studio runs on Windows, Mac OS X and Linux platforms, there might also be minor differences in the steps for the different platforms.

Install Git

Шаги по установке Git

  1. Check that you don’t already have Git installed. You can do this by typing “git” in the Windows search bar – if you see “Git bash” or some other form of Git, it is already installed and you can go straight to installing Android Studio:

Git_installed

  1. If you don’t have Git installed, download and install the latest version for your system from the «Download» section here. Любая новая версия Git должна работать, выбирайте версию в соответствии с вашей системой - Mac, Windows или Linux.

Note for Mac users: the Git webpage will also guide you to install an additional program called «homebrew» to aid the installation. Если вы устанавливаете Git через homebrew, то нет необходимости изменять настройки.

  • During the installation, when you are asked to «select destination location» make a note of where Git is being installed (the «installation path») you will need to check it in the next step. Это будет что-то вроде «C:\Program Files\Git\cmd\git.exe»

  • По мере прохождения нескольких шагов установки Git, принимайте все параметры по умолчанию.

  • После установки, если вы забыли место установкин Git, вы можете найти его следующим образом: введите «git» в строке поиска ПК, щелкните правой кнопкой мыши на «Git bash», выберите «открыть местоположение файла», наведите курсор мыши на значок «Git bash»., который затем покажет, где он установлен.

  • Перезагрузите компьютер перед следующим шагом.

Установите Android Studio

  • You have to be online all of the time during the following steps, as Android Studio downloads several updates

One of the most important things when installing Android Studio is be patient! During installation and setup, Android Studio is downloading a lot of stuff which will take time.

Different UI

Important note: Android Studio changed its UI during the last releases. This guide shows the steps with the new UI. The screenshots were taken with «Ladybug», so newer versions may look slightly different. If you still use the older UI, you might want to change Android Studio to the new UI first following these instructions.

The Android studio version is very important. See the instructions above to pick the proper version of Android Studio.

Download the current version of Android Studio or an older version from the Archives and accept the download agreements.

DownloadAndroidStudio

Once the download is finished, start the downloaded application to install it on your computer. You might need to accept/confirm some warnings about downloaded apps from Windows!

Install Android Studio by clicking «Next», as shown in the following screenshots. You do not need to change any settings!

Welcome_to_Android_Studio_Setup

If you want to save hard disk space, you can uncheck Android Virtual Device: it is not used for building AAPS.

Choose_components

Configuration_Settings

Now click on «Install»:

Choose_start_Menu_Folder

Once it’s completed, press «Next»

Installation_Complete

In the last step, click on «Finish» to start Android Studio for the first time.

Completing_Android_Studio_Setup

You will be asked if you want to help improve Android Studio. Choose the option to your liking, it won’t make any difference for the following steps.

Help_improve_Android_Studio

The welcome screen greets you to the installation of Android Studio. Press «Next».

Welcome

Select «Standard» as installation type.

Install_Type

Verify the settings by clicking «Next» again.

Verify_Settings

Now you need to accept the license agreements. You have two sections (1 + 3) on the left side which you have to select one after the other and each select «Accept» (2 + 4) on the right side.

Then the «Finish» (5) button can be clicked.

License_Agreement

Some Android packages will now be downloaded and installed. Be patient and wait.

When it’s finished, you will find the following screen where you can select «Finish» again.

Downloading_Components

You will now see the Welcome screen of Android Studio.

Welcome_to_Android_Studio

Загрузите код AAPS

On the Android Studio Welcome screen, check that «Projects» (1) is highlighted on the left.

Then click «Clone Repository» (2) on the right:

Get_from_VCS

Теперь мы скажем программе Android Studio, откуда получить код:

Get from Version Control

  • Должен быть выбран «URL репозитория» (по умолчанию) слева (1).

  • В качестве системы управления версиями должен быть выбран «Git» (по умолчанию) (2).

  • Теперь скопируйте URL-адрес:

    https://github.com/nightscout/AndroidAPS.git
    
    

Context | Edit Context ``` и вставьте его в текстовое поле URL (3).

  • Check the (default) directory for saving the cloned code does not already exist on your computer (4). You can change it to some directory, but please remember where you stored it!

  • Теперь нажмите кнопку «Клонировать» (5).

INFORMATION

Make a note of the directory. It is where your sourcecode is stored!

Теперь вы увидите экран, сообщающий, что репозиторий клонируется:

cloning_repository

At some point, Android Studio will close and start again. You may be asked whether you want to trust the project. Нажмите на «Доверять проекту»:

Trust project

Только для пользователей Windows: Если ваш брандмауэр запрашивает разрешение, предоставьте доступ:

Firewall permission java

После успешного клонирования репозитория, Android Studio откроет клонированный проект.

New UI

Android Studio changed its UI recently. New installations of Android Studio use the new UI by default!

Only if your Android Studio looks different, you might need to switch to the new UI: Click on the hamburger menu on the top left, then select Settings (or Preferences on Apple computers). In Appearance & Behavior, go to New UI and tick Enable new UI. Then restart Android Studio to start using it.

If you don’t find the option New UI don’t worry: you are already using it!

When Android Studio opened, wait patiently (this may take a few minutes), and particularly, do not update the project as suggested in the pop-up.

Android Studio will start a «Gradle project sync» automatically, which will take a couple of minutes to finish. You can see it (still) running:

AS_download_dependencies

NEVER UPDATE GRADLE!

Android Studio might recommend updating the gradle system. Never update gradle! This will lead to difficulties.

Only on windows computers: You might get a notification about windows defender running: Click on Automatically and confirm, it will make the build run faster!

Windows Defender

You can leave the gradle sync running and follow the next steps already.

(Сборка-APK-задать-путь-к-git-в-настройках) =

Set Git path in Android Studio preferences

Now we will tell Android studio where to find Git, which you installed earlier.

  • Windows users only: Make sure you have restarted your computer after installing Git. If not, restart now and re-open Android Studio

In the top left corner of Android Studio, open the hamburger menu and navigate to File > Settings (on Windows) or Android Studio > Preferences (on Mac). This opens the following window, click to expand the dropdown called Version Control (1) and select Git (2)

Version_control_Git

Check if Android Studio can automatically locate the correct Path to Git executable by clicking the button «Test» (1):

Git Executable

If the automatic setting is successful, your current version of Git will be displayed next to the path.

Git_version_displayed

If you find that git.exe is not found automatically, or that clicking «Test» results in an error, you can either

  • manually enter the path which you saved earlier, or

  • click on the folder icon (1) and manually navigate to the directory where git.exe was installed earlier

  • Verify your settings with the Test button!

    Git not found

Построение подписанного приложения AAPS apk

Important: Make sure the gradle sync is finished successfully before proceeding!

Click the hamburger menu on the top left to open the menu bar. Select Build (1), then select Generate Signed App Bundle / APK (2)

Build apk

Select «APK» (1) instead of «Android App Bundle» and click «Next» (2):

APK instead of bundle

In the next screen, make sure that «Module» is set to «AndroidAPS.app» (1). The part before «.app» is the name of the folder you cloned the code into.

INFORMATION!

If you want to create the apk for your watch, you now need to select AndroidAPS.wear!

Create_key_store

Нажмите «Создать новый…» (2) для создания хранилища ключей.

INFORMATION!

You will only need to create the keystore once. If you have built AAPS before, do NOT create a new keystore but select your existing one and enter its passwords!

Note: The key store is a file in which the information for signing the app is stored. Он зашифрован и информация защищена паролями.

Create key store

  • Click the «folder» symbol (1) to select a path on your computer for your key store.

    Do not use the directory where you stored your sourcecode but some directory that you would also transfer to a new computer.

WARNING!

Make sure to note down for yourself where your keystore is stored. You will need it when you build the next AAPS update!

  • Now choose a simple password (and make a note of it), enter it in the password box (2), and confirm it (2).

    Примечание: Пароли для хранилища ключей и ключей не должны быть сложными. If you lose your password in the future, see Reinstalling AAPS with a new keystore.

Предупреждение

Avoid special characters in your passwords. Use only letters and digits for the keystore and key passwords. In particular, do not use $, a backtick, " or \. If you later switch to the Browser build and reuse this keystore, these characters can make the signing step fail, see Browser build troubleshooting.

  • По умолчанию псевдоним (3) для вашего ключа это «key0», оставьте его без изменений.

  • Теперь вам нужен пароль для ключа. Для простоты можете использовать тот же пароль, что и для хранилища ключей выше. Enter a password (4) and confirm it.

WARNING!

Note down these passwords! You will need them when you build the next AAPS update!

  • The validity is 25 years by default, leave it as it is.

  • Enter your first and last name (5). No other information needs to be added but you are free to do (6-7).

  • Нажмите «OK» (8), чтобы продолжить:

On the Generate signed App Bundle or APK page, the path to your keystore will now be displayed. Now re-enter the Key Store password (1) and Key password (2), and tick the box (3) to remember passwords, so you don’t have to enter them again next time you build the apk (i.e. when updating to a new AAPS version). Нажмите «Далее» (4):

Remember passwords

On the next screen, select build variant «fullRelease» (1) and click «Create» (3). You should remember the destination folder displayed at (2), as later you will find your built apk file there!

Select build variant

Android Studio will now build the AAPS apk. It will show «Gradle Build running» (2) at the bottom right. The process takes some time, depending on your computer and internet connection, so be patient! If you want to watch the progress of the build, click on the small hammer «build» (1) at the bottom of Android Studio:

Gradle Running

Теперь вы можете наблюдать за ходом построения приложения:

Android_Studio_building

После завершения сборки Android Studio выведет сообщение «СБОРКА ЗАВЕРШЕНА УСПЕШНО.». Вы увидите всплывающее уведомление, на которое можете нажать, чтобы найти файл («locate»). If you miss this, click on the notification icon (1) to bring up the Notifications, and then on locate (2):

Build finished

If the build was not successful, refer to the Android Studio Troubleshooting section.

В окне Уведомления нажмите на синюю ссылку «locate»:

Locate build Your file manager will open and show you the build apk file that you have just built.

File location apk

Поздравляем! Now you have built the AAPS apk file, you will be transferring this file to your smartphone in the next section of the docs.

Совет

If you think you might want to use an Android Wear smartwatch in the future, this is the best time to build the AAPS Wear apk to be sure it will be synchronized with your AAPS apk.

Move to the next stage of Transferring and Installing AAPS.