Sestavení APK

Vyrobte si místo stažení

AndroidAPS is not available as download due to regulation for medical devices. It is legal to build the app for your own use, but you must not give a copy to others! Další informace naleznete v části Časté dotazy.

Důležité poznámky

Doporučená specifikace počítače pro vytváření souboru apk

OS (Only 64 bit) Windows 8 nebo novější Mac OS 10.14 nebo novější Jakýkoli Linux, který podporuje Gnome, KDE nebo Unity DE;  GNU C knihovnu 2.31 nebo novější

CPU (Only 64 bit)

CPU s architekturou x86_64; 2. generace Intel Core nebo novější, nebo AMD CPU s podporou
Windows Hypervisor
Procesory založené na ARM nebo Intel Core 2. generace nebo novější s podporou
Hypervisor.Framework
CPU s architekturou x86_64; Intel Core 2. generace nebo novější nebo processor AMD s podporou AMD Virtualization (AMD-V) a SSSE3

RAM

min. 8 GB

Pevný disk

Alespoň 30 GB volného místa. Je doporučeno SSD.

Rozlišení

Minimálně 1280 × 800

Internet

Širokopásmové připojení

Please be 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. It is strongly recommended to use SSD (Solid State Disk) instead of HDD (Hard Disk Drive) because it will take less time when you are building the APS installation apk file. Recommended is just recommended and it is not a mandatory. However, you may still use a HDD when you are building apk file but note that the building process can take a long time to complete, although once started, you can leave it running unattended.


Tento článek je rozdělený do dvou částí.

  • In the overview part there is an explanation on what steps are necessary to build the APK file.

  • In the step by step walkthrough part you will find the screenshots of a concrete installation. Because the versions of Android Studio - the software development environment which we will use to build the APK - will change very quickly this will be not identical to your installation but it should give you a good starting point. Android Studio also runs on Windows, Mac OS X and Linux and there might be small differences in some aspects between each platform. If you find that something important is wrong or missing, please inform the facebook group „AndroidAPS users“ or in the Discord chat Android APS so that we can have a look at this.

Přehled

In general, the steps necessary to build the APK file:

  1. Nainstalujte git

  2. Instalace Android Studio

  3. Nastavte v předvolbách Android Studio cestu ke gitu

  4. Stáhněte si kód AndroidAPS

  5. Stáhněte Android SDK

  6. Build the app (generate signed apk)

  7. Nahrajte aplikaci do mobilu

  8. Možnost „Identify receiver“ při používání xDripu+

Průvodce krok za krokem

Detailed description of the steps necessary to build the APK file.

Nainstalujte git (pokud ho ještě nemáte)

Follow the manual on the git installation page.

Instalace Android Studio

The following screenshots have been taken from Android Studio Version Arctic Fox | 2020.3.1. Screens can change in future versions of Android Studio. But you should be able to find your way through. Help from the community is provided.

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

Download Android Studio from here and install it on your computer.

On first start you will find the setup wizard:

Select „Do not import settings“ as you have not used it before.

Do not import settings

Decide whether you want to share data with Google or not.

Share data with Google

On the following screen click „Next“.

Welcome screen

Select „Standard“ installation and click „Next“.

Standard installation

Select the theme for the user interface you like. (In this manual we used „Light“.) Then click „Next“.

Note: This is just the color scheme. You can select whatever you like (i.e. „Darcula“ for dark mode). This selection has no influence on building the APK but the following screenshots might look different.

UI color scheme

Click „Finish“ on the „Verify Settings“ dialog.

Verify settings

Wait while Android Studio downloads additional components and be patient. Once everything is downloaded button „Finish“ turns blue. Click the button now.

Downloading components

Nastavení cesty k nástroji git v předvolbách

Make sure git is installed on your computer and you have restarted your computer after installing.

On the Android Studio welcome screen click „Customize“ (1) on the left and then select the link „All settings…“ (2):

Android Studio settings from welcome screen

Windows

  • As windows user, make sure you have restarted your computer after installing Git.

  • Double-click „Version Control“ (1) to open the sub-menu.

  • Click Git (2).

  • Make sure update method „Merge“ (3) is selected.

  • Check if Android Studio can locate path to git.exe automatically by clicking the button „Test“ (4).

    Android Studio settings

  • If automatic setting is successful git version will be displayed next to the path.

    Git version displayed

  • Eventually git.exe cannot be found automatically or the Test will result in an error (1):

    Git not found

    In this case click on the folder icon (2).

  • Use search function in windows explorer to find „git.exe“ if you are unsure where git has been installed. You are looking for a file named „git.exe“, located in \bin folder.

  • Select path to git.exe and make sure you selected the one in ** \bin\ ** folder (3) and click „OK“ (4).

    Select git manually

  • Check your selected git path again with the „Test“ button as described above.

  • When the git version is displayed next to the path (see screenshot above), close settings window by clicking „OK“ button (5).

Mac

  • Any git version should work. For example https://git-scm.com/download/mac.

  • Use homebrew to install git: $ brew install git.

  • For details on installing git see the official git documentation.

  • If you install git via homebrew there is no need to change any preferences. Pokud by bylo třeba: Najdete je zde: Android Studio - Preferences.

Stáhněte si kód AndroidAPS

  • On the Android Studio welcome screen select „Projects“ (1) on the left and then „Get from VCS“ (2).

    Android Studio wizard

    • If you already opened Android Studio and do not see the welcome screen anymore select File (1) > New (2) > Project from Version Control… (3)

      Check out project from version control within Android Studio

    • We will now tell Android Studio were to get the code from:

    • Make sure you have selected „Repository URL“ on the left (1).

    • Check if „Git“ is selected as version control (2).

    • Copy and paste the URL https://github.com/nightscout/AndroidAPS to the main AndroidAPS repository into the URL textbox (3).

    • Choose the directory where you want to save the cloned code (4).

      Clone Git

  • Click button „Clone“ (5).

    Clone repository

  • Do not click „Background“ while repository is cloned!

  • After the repository is cloned successfully, Android Studio will open the cloned project.

  • You will be asked whether you want to trust the project. Click on „Trust project“!

    Trust project

  • In the status bar at the bottom you will see the information that Android Studio is running background tasks.

    Background tasks

  • Grant access if your firewall is asking for permission.

    Firewall permission java

  • Once the background tasks are finished you will probably see an error saying that errors occurred (1) or (2) or (3).

    SDK licence

    Don’t worry, this will be solved soon!

Stáhněte Android SDK

  • In the menu, go to File (1) > Settings (2).

    Open settings

  • Double-click on Appearance & Behaviour to open its submenu (1).

  • Double-click on System Settings (2) and select Android SDK (3).

  • Tick the box left of „Android 9.0 (Pie)“ (4) (API Level 28).

    SDK settings

  • Confirm changes by clicking OK.

    Confirm SDK changes

  • Accept licence agreement (1) and click „Next“ (2).

    Accept SDK licence

  • Wait until the SDK download and installation is finished.

    Wait during SDK installation

  • When SDK installation is completed the „Finish“ button will turn blue. Click this button.

    Finish SDK installation

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

  • If you see an information on the lower right side of your Android Studio window that Android Gradle Plugin is ready to update click on the text „update“ (1).

    No gradle update

  • In the dialog box the select „Don’t remind me again for this project“ (2).

    No gradle update

  • Restart Android Studio before you continue.

Vytvořte podepsaný soubor APK

Signing means that you indicate your app to be your own creation but in a digital way as a kind of digital fingerprint within the app itself. That is necessary because Android has a rule that it only accepts signed code to run for security reasons. For more information on this topic, follow this link.

  • After Android Studio is started, wait until all background tasks are finished.

    Wait for background tasks

    • Warning: If errors occur, do not continue with the following steps. \ Consult the troubleshooting section for known problems!

    Gradle Sync Error

  • Click „Build“ (1) in the menu bar and select „Generate Signed Bundle / APK…“ (2).

    Sestavení apk

  • Select „APK“ (1) instead of „Android App Bundle“ and click „Next“ (2).

    APK namísto možnosti bundle

  • Make sure that module is set to „AndroidAPS.app“ (1).

  • Click „Create new…“ (2) to start creating your key store.

    Note: A key store in this case is nothing more than a file in which the information for signing is stored. It is encrypted and the information is secured with passwords.

    Create key store

  • Click the folder symbol to select a path on your computer for your key store.

    Create key store

  • Select the path where your key store shall be saved (1).

    Create key store

    Warning: Do not save in same folder as project. You must use a different directory! A good location would be your home folder.

  • Type a file name for your key store (2) and confirm with „OK“ (3).

  • Enter (2) and confirm (3) the password for your key store. Select key store path

    Note: Passwords for key store and key do not have to be very sophisticated. Make sure to remember those or make a note in a safe place. In case you will not remember your passwords in the future, see troubleshooting for lost key store.

  • Enter an alias (4) for your key. Choose whatever you like.

  • Enter (5) and confirm (6) the password for your key

  • Validity (7) is 25 years by default. You do not have to change the default value.

  • First and last name must be entered (8). All other information is optional.

  • Click „OK“ (9) when you are done.

  • Make sure the box to remember passwords is checked (1). So you don’t have to enter them again next time you build the apk (i.e. when updating to a new AndroidAPS version).

  • Click „Next“ (2).

    Remember passwords

  • Select build variant „fullRelease“ (1) and press „Finish“.

    Select build variant

  • Android Studio will show „Gradle Build running“ at the bottom. This takes some time, depending on your computer and internet connection. Be patient!

    Gradle Running

  • Android Studio will display the information „Generate Signed APK“ after build is finished.

    Build finished

  • In case build was not successful refer to the troubleshooting section.

  • Click on the notification to expand it.

  • Click on the link „locate“.

    Locate build

    • If the notification is gone, you can always open the „Event log“ and select the same link there. Úspěšné sestavení - event log

  • Your file manager/explorer will open. Navigate to the directory „full“ (1) > „release“ (2).

    Umístění souboru apk

  • „app-full-release.apk“ (3) is the file you are looking for!

Přeneste soubor APK do telefonu

Easiest way to transfer app-full-release.apk to your phone is via USB cable or Google Drive. Please note that transfer by mail might cause difficulties and is not the preferred way.

On your phone you have to allow installation from unknown sources. Manuals how to do this can be found on the internet (i.e. here or here).

Řešení problémů

See separate page troubleshooting Android Studio.