‏‏the following are installed on my computer:
Godot_v4.2.2-stable_win64
android-studio-2023.3.1.19-windows
JDK: eclipse adoptium temurin-17.0.11+9

i built a simple 2d platformer game by a tutorial on YT, added touch buttons by another tutorial, and wanted to try it on my phone.
exporting to apk is HELL, I can't understand how to do it right, tried several tutorials, lastly i got these errors:

  • editor/export/editor_export_platform.h:179 - Code Signing: All 'apksigner' tools located in Android SDK 'build-tools' directory failed to execute. Please check that you have the correct version installed for your target sdk version. The resulting APK is unsigned.
  • All located 'apksigner' tools in C:\Users\%USERPROFILE%\AppData\Local\Android\Sdk/build-tools failed to execute

how can i fix the problem and how can i export to apk?

edit: mostly used this tutorial but i tried to fix it with couple of tutorials and a bit of self try&fail, so in this stage i hope that i did returned it to the starting point.
also the android sdk path that is set up in the editor settings is C:\Users\%USERPROFILE%\AppData\Local\Android\Sdk\

    In Editor Settings / General / Export / Android, are all of these fields populated?

    Android SDK Path
    Debug Keystore
    Debug Keystore User
    Debug Keystore Pass
    Java SDK Path

    I'm using Linux, so my paths would be different than yours.

    yes all fields are populated, as followed:

    chameli All 'apksigner' tools located in Android SDK 'build-tools' directory failed to execute.

    Try doing a web search on that error message. There are various solutions posted.

    chameli hmmm iirc you just need the export template and android SDK/JDK installed to export apk, android studios is only needed if you want to tinker with 3rd party library such as ads or game platform specific apis.

      13 days later

      i don't know if i'm on the right path (pun intended) but somwhere along the way, i figured (correct me if i'm wrong) that i don't have a .exe file of the apksigner, i have no idea why android studio doesn't install such file, but there are only 2 files named apksigner in the "C:\Users__USER__\AppData\Local\Android\Sdk\build-tools\33.0.2" directory:
      1) a .bat file
      2) a .jar file, in the "lib" sub-directory
      do i need to do something about it to fix the problem or is it completly unrelated?
      the little info i can gather from searching online for answers is too advanced for me to understand because i'm just starting this journey in coding and game building, so i'd appreciate any help.

      MagickPanda i worked by the tutorial given in the goddot docs i also tried your way in one point, it didn't work

        chameli 1) a .bat file
        2) a .jar file, in the "lib" sub-directory

        That looks normal.

        Can you run the apksigner .bat file from the command line? If you run it without parameters, it should display usage information:
        C:\Users__USER__\AppData\Local\Android\Sdk\build-tools\33.0.2\apksigner

        I haven't used Windows for a long time. I don't remember if that's the way to run a .bat file.

          DaveTheCoder needed to set the JAVA_HOME but i did it, tryed exporting again and this time it worked! btw i set the JAVA_HOME the same as the java sdk path (in godot)

          following question: why do i need a .idsig file? i exported the game to apk and ran it on my andrid phone without copying the idsig file to my phone, is it only necessary for distribution for people who can't trust a random developer?

            chameli is it only necessary for ...

            I'm not sure, but this provides some more information (replace APKSIGNER_PATH, APK_PATH and APK_FILE):
            APKSIGNER_PATH/apksigner verify --verbose APK_PATH/APK_FILE.apk

            Reference: https://developer.android.com/tools/apksigner

            I've exported Godot and Android Studio .apk's to my Android phone many times, using a USB cable or wireless, and have never had to deal with an .idsig file. I haven't yet published an .apk for other people to use.

              DaveTheCoder i didn't export the game directly to my phone, i copied the apk from my laptop to my phone. godot created the idsig file when i exported the game to apk, theres probably a switch to prevent godot from creating an idsig file...

              after reading a bit of a rabbit hole from your reference:
              if i'm understanding correctly (considaring i'm lacking knowledge and english is not my native tongue) the singing is all accross the apk-file code, and is there to 1) identify the creator, 2) to show that a certain part in the code was not tempered and is safe.
              like a sticky tape on the door where your name is wrriten on, it shows you no one changed the state of the door and if someone will look at it they would know you put it there.

              the idsig is just an external signature (that doesn't change the APK) and is used only on large files (2GB+) where you want to make the install faster using ADB Incremental APK installation (only on android 11+ and on v4 signature scheme), then the installer uses the idsig as reference, enabling starting the game before install is complete. (i guess idsig is short for "ID SIGnature")

              so to conclude, as long as youre apps are under 2GB, the idsig file is not necessary.