פתרון תקלות ב-Android Studio

אבד ה-keystore

If you use the same keystore when updating AAPS 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:

  1. Export settings on your phone.

  2. העתיקו או העלו את קובץ ההגדרות מהטלפון שלך למיקום חיצוני (כלומר למחשב, שירות אחסון בענן…).

  3. Generate signed apk of new version as described on the Update guide and transfer it to your phone.

  4. הסירו את ההתקנה של גרסת ה-AAPS הקודמת מהטלפון.

  5. התקינו את גרסת ה-AAPS החדשה בטלפון.

  6. Import settings to restore your objectives and configuration.

    אם אינכם מוצאים אותן בטלפון, העתיקו אותן מהאחסון החיצוני אל הטלפון.

  7. בדקו את אפשרויות אופטימיזציית הסוללה שלכם והשביתו אותן שוב.

  8. Keep on looping.

Gradle Sync failed

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.

Gradle Failed

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.

שינויים שלא הוגשו

If you receive a failure message like

Gradle Uncommited Changes

שלב 1 - בדקו את התקנת git

  • פתחו את לשונית terminal (1) בתחתית Android Studio, העתקו והדבקו את הטקסט הבא או הקלדו בטרמינל:

    git --version
    

    Gradle Git Version

    הערה: יש רווח ושני מקפים בין git ל-version!

  • עליכם לקבל הודעה שאומרת איזו גרסת git מותקנת, כפי שניתן לראות בצילום המסך למעלה. In this case, go to Step 2.

  • למקרה שתקבלו את ההודעה

    Git: command not found
    

    התקנת Git שלכם בעייתית.

  • בדקו את התקנת git

  • אם אתם משתמשי Windows ו-git הותקן זה עתה, עליכם להפעיל מחדש את המחשב כדי להפוך את git לזמינה גלובלית לאחר ההתקנה

  • אם Git מותקן והפעלתם מחדש (אם על Windows), ו-git עדיין לא נמצא:

  • חפשו במחשבכם את הקובץ ”git.exe“.

    זכרו באיזו ספרייה הקובץ נמצא.

  • עברו אל Environment variables (משתני הסביבה) בחלונות, בחרו את המשתנה ”PATH“ ולחצו על ערוך. הוסיפו את הספרייה בה מצאתם את התקנת git שלכם.

  • שמירו וסגירו.

  • הפעילו מחדש את Android Studio.

שלב 2: בדקו אם יש שינויים לא שלא הוגשו (uncommitted changes).

  • ב-Android Studio, פתחו את הלשונית ”Commit“ (1) בצד שמאל.Commit Tab: Uncommitted changes

  • אתם יכולים לראות ”Default changeset“ (2) או ”Unversioned files“ (3):

    • עבור ”Default changeset“, כנראה עדכנתם את Gradle או שיניתם בטעות חלק מתוכן הקובץ.

    • לחצו לחיצה ימנית על ”Default Changeset“ ובחרו ”Rollback“

      Commit Tab: Rollback changes

    • הקבצים נשלפים שוב משרת ה-Git. If there are no other changes in the commit tab, go to Step 3.

  • אם אתם יכולים לראות ”Unversioned Files“, ייתכן שאחסנתם קבצים בספריית sourecode שלך שצריכה להיות במקומות אחרים, למשל קובץ מאגר המפתחות שלך.

    • השתמשו בסייר הקבצים הרגיל במחשב כדי להעביר או לגזור ולהדביק את הקובץ למקום אחר.

    • Go back to Android Studio and click the Refresh button (4) within the Commit tab to make sure the file is not stored in the AAPS directory anymore.

      If there are no other changes in the commit tab, go to Step 3.

שלב 3: סנכרן מחדש את Gradle (שוב)

Follow the instructions at Gradle Resync.

Incompatible version of Android Gradle plugin

If you experience the following error message

Incompatible version of Android Gradle plugin

You are using an outdated version of Android Studio. In the menu, go to Help > Check for updates and install any updates of Android Studio and its plugins that are found.

Android Gradle plugin requires Java 17 to run

You might experience this error message:

Android Gradle plugin requires Java 17 to run

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).

Gradle Settings

When you have opened the Gradle settings dialog, open the options (1) at ”Gradle JDK“ and selected the ”jbr-17“ (2), which should be located within your Android Studion installation directory.

Gradle Settings

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 2022.3 Giraffe) or newer.

Now you need to trigger a Gradle Resync

Could not resolve/No cached version

You might get this error message:

![Could not resolve... No cached version](../images/studioTroubleshooting/08_NoCachedVersion.png)
  • בצד ימין, פתחו את הלשונית Gradle (1).

    ודאו שהלחצן המוצג ב-(2) לא נבחר.

    Gradle Offline Mode

  • Now you need to trigger a Gradle Resync

לא ניתן להפעיל את תהליך daemon

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.

Screenshot Unable to start daemon process

Gradle Resync

If you can still see the message that the gradle sync failed, now select the Link ”Try again“. Gradle Sync Failed Mode

If you don’t see the a message anymore, you can still trigger this manually:

  • פתחו את הלשונית Gradle (1) בגבול הימני של Android Studio.

    Gradle Reload

  • Right-click on AAPS (2)

  • לחצו על ”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:

APK generated with 0 build variants

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!

האפליקציה נוצרה עם אזהרות compiler/kotlin

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.

Gradle finished with 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

Key was created with errors

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 AAPS

  • במקרה שאתם משתמשים באפליקציית Dexcom G6 הפרוצה: אפליקציה זו מיושנת. Use the BYODA app instead.

  • In case you are using xDrip+: Identify receiver as described on xDrip+ settings page.

אפליקציה לא הותקנה

phone app note installed

  • ודאו שהעברתם את הקובץ ”app-full-release.apk“ לטלפון שלכם.

  • אם הטלפון מציג הודעת ”אפליקציה לא מותקנת“, בצעו את השלבים הבאים:

  1. ייצוא הגדרות (בגרסת AAPS שכבר מותקנת בטלפון שלך)

  2. הסירו את AAPS מהטלפון.

  3. הפעילו מצב טיסה וכבו את הבלוטות«.

  4. התקינו גרסה חדשה (”app-full-release.apk“)

  5. ייבוא הגדרות

  6. הפעילו שוב את הבלוטות« והשביתן את מצב הטיסה

האפליקציה מותקנת אך הגרסה ישנה

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

אף אחת מהאפשרויות לא עזרה

If non of the above tips helped you might consider building the app from scratch:

  1. ייצוא הגדרות (בגרסת AAPS שכבר מותקנת בטלפון שלך)

  2. הכינו את סיסמת המפתח וסיסמת מאגר המפתחות שלכם. במקרה ששכחתם את הסיסמאות, תוכלו לנסות למצוא אותן בקבצי הפרויקט כפי שמתואר כאן.

    או שתצרו מאגר מפתחות חדש.

  3. Build app from scratch as described here.

  4. לאחר בניית ה-APK, מחקו את האפליקציה שבטלפון, העבירו את ה-APK החדש לטלפון והתקינו.

  5. ייבאו הגדרות שוב כדי לשחזר את המשימות ואת ההגדרות שלכם.

  6. בדקו את אפשרויות אופטימיזציית הסוללה שלכם והשביתו אותן שוב.

במקרה הגרוע ביותר

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.

https://stackoverflow.com/questions/39953495/how-to-completely-uninstall-android-studio-from-windowsv10.

Install Android Studio from scratch as described here.