Fehlerbehebung für Android Studio
Verlorener Keystore
If you use the same keystore when updating AndroidAPS you do not have to uninstall the previous version on your smartphone. That’s why it is recommended to store the keystore in a save place.
If you try to install the apk, signed with a different keystore than before, you will get an error message that the installation failed!
In case you cannot find your old keystore or its password anymore, proceed as follows:
Export settings on your phone.
Kopiere die Datei mit den Einstellungen von deinem Smartphone auf ein externes Gerät (d.h. dein Computer, externe Festplatte) oder lade sie in deinen Cloudspeicher hoch.
Generate signed apk of new version as described on the Update guide and transfer it to your phone.
Deinstallieren die Vorgängerversion von AAPS auf Deinem Smartphone.
Installiere die neue AAPS-Version auf Deinem Smartphone.
Import settings to restore your objectives and configuration.
Prüfe deine Einstellungen und deaktiviere den Energiesparmodus.
Falls du die Einstellungen nicht findest, kopiere sie von deinem externen Speicher auf dein Smartphone.
Loope weiter!
Gradle Sync schlägt fehl
Gradle Sync can fail to various reasons. Wen you get a message saying that gradle sync failed, open the „Build“ tab (1) at the bottom of Android Studio and check what error message (2) is displayed.
These are the usual gradle sync failures:
Important: After you have followed the instructions for your specific problem, you need to trigger the gradle sync again.
Uncommitted changes
If you receive a failure message like
Schritt 1 - Überprüfe deine Git Installation
Öffne den Terminal Reiter (1) im unteren Bereich von Android Studio und kopiere den folgenden Text, oder tippe ihn ins Terminal ein.
git --version
Hinweis: Es ist ein Leerzeichen und zwei Bindestriche zwischen git und version!
Im Terminal sollte ein Hinweis erscheinen, der übermittelt welche git Version installiert ist (siehe Screenshot oberhalb). In this case, go to Step 2.
Falls du einen Hinweis wie diesen bekommst
Git: command not found
ist deine git Installation fehlerhaft.
Falls du mit Windows arbeitest und Git erst kurz zuvor installiert wurde, solltest du deinen Computer neu starten, um Git nach der Installation global verfügbar zu machen
Falls Git installiert ist, du deinen Computer neu gestartet hast (wenn du Windows benutzt), und Git immer noch nicht gefunden werden kann:
Suche auf deinem Computer nach einer Datei „git.exe“.
Notiere dir den Pfad, wo diese Datei auf dem Computer liegt.
Gehe zu den Umgebungsvariablen auf Windows, wähle die Variable „PATH“ und klicke bearbeiten. Füge den zuvor notierten Pfad deiner Git Installation hinzu.
Speichern und schließen.
Starte Android Studio neu.
Schritt 2: Prüfe, ob es uncommitted changes gibt.
In Android Studio: öffne den „Commit“ Tab (1) auf der linken Seite.
Dort siehst du entweder „Default changeset“ (2) oder „Unversioned files“ (3):
Bei „Default changeset“, hast du wahrscheinlich Gradle upgedatet oder aus Versehen etwas an einer Datei geändert.
Mache einen Rechtsklick auf „Default Changeset“ und wähle „Rollback“
Diese Dateien werden erneut vom Git Server gezogen. If there are no other changes in the commit tab, go to Step 3.
Falls du „Unversioned Files“ sehen kannst, hast du wahrscheinlich Dateien im Sourcecode Projekt abgelegt, die dort nicht hingehören (z.B: deine keystore Datei).
Benutze deinen Datei Explorer und verschiebe die Datei an einen Ort, außerhalb des Source Code Projekts.
Gehe zurück zu Android Studio und klicke den Refresh Button (4) im Commit Tab, um sicherzustellen, dass die Datei nicht mehr im AndroidAPS Projekt liegt.
If there are no other changes in the commit tab, go to Step 3.
Schritt 3: Resync Gradle (erneut)
Follow the instructions at Gradle Resync.
Das Android Gradle Plugin benötigt Java 11
You might experience this error message:
Click on „Gradle Settings“ (1) to go to open the gradle settings.
If you don’t have the link to the „Gradle Settings“, open the Gradle settings manually by selecting the Gradle Tab on the right border (1), select the tools icon (2) and there the item ‚Gradle Settings‘ (3).
When you have opened the Gradle settings dialog, open the options (1) at „Gradle JDK“ and selected the „Embedded JDK version“ (2).
Press „OK“ to save and close the settings dialog.
Important: If you don’t see the setting „Gradle JDK“, you might have not updated Android Studio. Make sure you are using Android Studio 2021.1.1 Bumblebee) or newer.
Now you need to trigger a Gradle Resync
Could not resolve/No cached version
You might get this error message:

Öffne den Gradle Tab auf der rechten Seite (1).
Stelle sicher, dass der Button der bei (2) zu sehen ist, NICHT selektiert ist.
Now you need to trigger a Gradle Resync
Unable to start daemon process
If you see an error message like the one below you probably use a Windows 10 32-bit system. This is not supported by Android Studio 3.5.1 and above and unfortunately nothing the AAPS developer can do about.
If you are using Windows 10 you must use a 64-bit operating system.
There are a lot of manuals on the internet how to determine wether you have a 32-bit or 64-bit OS - i.e. this one.
Gradle Resync
If you can still see the message that the gradle sync failed, now select the Link „Try again“.
If you don’t see the a message anymore, you can still trigger this manually:
Öffne den Gradle Tab (1) am rechten Rand von Android Studio.
Rechtsklick auf AndroidAPS (2)
Klicke auf „Reload Gradle Project“ (3)
Generate Signed APK generated successfully with 0 build variants
When you generate the signed apk, you might get the notification that generation was successfully but are told that 0 build variants where generated:
This is a false warning. Check the directory your selected as „Destination folder“ for generation (step Generate Signed APK) and you will find the generated apk there!
App was created with compiler/kotlin warnings
If your build completed successfully but you get compiler or kotlin warnings (indicated by a yellow or blue exclamation mark) then you can just ignore these warnings.
Your app was build successfully and can be transferred to phone!
Key was created with errors
When creating a new keystore for building the signed APK, on Windows the following error message might appear
This seems to be a bug with Android Studio 3.5.1 and its shipped Java environment in Windows. The key is created correctly but a recommendation is falsely displayed as an error. This can currently be ignored.
No CGM data is received by AndroidAPS
Falls Du gepatchte Dexcom G6-App verwendest: Diese App ist veraltet. Use the BYODA app instead.
In case you are using xDrip+: Identify receiver as described on xDrip+ settings page.
App not installed
Stelle sicher, dass Du die “app-full-release.apk” auf Dein Smartphone übertragen hast.
Falls „App not installed“ auf dem Smartphone angezeigt wird, gehe wie folgt vor:
Exportiere die Einstellungen (in der AAPS Version, die bereits auf Deinem Smartphone installiert ist)
Deinstalliere AAPS auf Deinem Smartphone.
Aktiviere den Flugmodus & schalte Bluetooth aus.
Installiere die neue Version („app-full-release.apk“).
Aktiviere Bluetooth wieder und schalte den Flugmodus aus.
App installiert, aber weiter die alte Version auf dem Smartphone
If you built the app successfully, transferred it to your phone and installed it successfully but the version number stays the same then you might have missed to update your local copy
Keiner der oben genannten Löungsvorschläge funktioniert
If non of the above tips helped you might consider building the app from scratch:
Exportiere die Einstellungen (in der AAPS Version, die bereits auf Deinem Smartphone installiert ist)
Halte Dein key Passwort und Dein key store Passwort bereit. Falls du Passwörter vergessen hast, kannst du versuchen sie in Projekt Dateien wiederzufinden wie hier beschrieben.
Oder verwende einfach einen neuen keystore.
Build app from scratch as described here.
Nachdem Du die APK erfolgreich erstellt hast, kannst Du die App auf Deinem Smartphone deinstallieren. Übertrage dann die neue APK auf Dein Smartphone und installiere diese.
Importiere Einstellungen erneut, um deine Zielsetzungen und Einstellungen wiederherzustellen.
Überprüfe deine Einstellungen und deaktiviere den Energiesparmodus erneut.
Worst case scenario
In case even building the app from scratch does not solve your problem you might want to try to uninstall Android Studio completely. Some Users reported that this solved their problem.
Make sure to uninstall all files associated with Android Studio. If you do not completely remove Android Studio with all hidden files, uninstalling may cause new problems instead of solving your existing one(s). Manuals for complete uninstall can be found online i.e.
Install Android Studio from scratch as described here.