Android APK Rejections / Upload Errors with Google Play & Amazon App Store.

adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,934

We have traced down issues with uploading to the Google Play & Amazon App Stores to how GameSalad Creator signs APKs.

Creator uses jarsigner, which is a tool provided by Java and used in Android 4.2 (API 17) and earlier.

Google has since release a newer tool called apksigner which does some things differently. Up until now, jarsigner was fine, but Google Play & the Amazon App Store will no longer accept apks signed with jarsigner.


Until we update Creator, you will need to sign manually using the command line.

For macOS, if you have Android Studio installed you can do the following:

  1. Download the apk with the Download button on publishing.
  2. Open Terminal
  3. Run the following command (replacing <things in> as needed)
~/Library/Android/sdk/build-tools/28.0.3/zipalign -v 4 <downloaded apk> <downloaded apk>_zipaligned.apk
~/Library/Android/sdk/build-tools/28.0.3/apksigner sign --ks <your keystore file> --in <downloaded apk>_zipaligned.apk --out <whateveryouwantotnameyourapk>.apk

That final APK <whateveryouwantotnameyourapk>.apk is what you upload to Google Play.

Your build tools may not be in build-tools/28.0.3. The number will change depending on when you installed Android Studio and which build tools version you chose to install after.

If you need help finding zipalign and apksigner try:

find ~/Library/Android/sdk -name apksigner

That should show the correct file path (possibly more than one, just use the one with the highest number).


For Window, the commands will be:

C:\Users\{user}\AppData\Local\Android\Sdk\build-tools\<build tools version>\zipalign.exe -v 4 <downloaded apk> <downloaded apk>_zipaligned.apk
C:\Users\{user}\AppData\Local\Android\Sdk\build-tools\<build tools version>\apksigner.bat sign --ks <your keystore file> --in <downloaded apk>_zipaligned.apk --out <whateveryouwantotnameyourapk>.apk


We will update this thread once we find a better solution to this problem (either updating the tools, building a solution for online signing, or both).

«13

Comments

  • TechnaturallyTechnaturally Member, PRO Posts: 25

    I appreciate the clear instructions for how to work-around this issue.

  • weaselpopgames2020weaselpopgames2020 Member, PRO Posts: 8

    Thank you very much for your efforts and instructions @adent42

  • ArmellineArmelline Member, PRO Posts: 4,971

    Awesome, thanks @adent42.

  • cagrisavancagrisavan Member, PRO Posts: 13

    It didn't work for me. I am so exhausted and angry. Pls help?


  • ArmellineArmelline Member, PRO Posts: 4,971
    edited May 15

    The things in the pointy brackets <these ones> need to be replaced with your own game's name etc.


    ~/Library/Android/sdk/build-tools/28.0.3/zipalign -v 4 <downloaded apk> <downloaded apk>_zipaligned.apk
    

    Would become

    ~/Library/Android/sdk/build-tools/28.0.3/zipalign -v 4 awesomegame awesomegame_zipaligned.apk
    

    etc.

  • cagrisavancagrisavan Member, PRO Posts: 13

    Thank you so much for your help Armelline. I tired but it did not work. I think I should wait until @adent42 update the new creator.

    Thank you

  • pinkio75pinkio75 Member, PRO Posts: 971

    Obviously you need to are inside the folder were are located the "command tools" so in the terminal write CD to change directory and go inside the right directory but if the error persist try to put: "./" before digit command, for example:

    ./zipalign -v 4 myapp.apk myapp_zipaligned.apk

    ./apksigner sign --ks yourkeystore.keystore --in myapp_zipaligned.apk --out myapp.apk

    I've put in the same directory all files, keystore and unsigned apk.

  • cagrisavancagrisavan Member, PRO Posts: 13

    Thanks pinkio i tired it said No such file or directory . When are you planning to solve this issue @adent42 ?

  • stragstrag Member, PRO Posts: 602

    Just wondered which components of Android Studio we actually need for apk signing

    Are you guys downloading the whole lot including legacy SDKs etc or just the build tools?

    It's a massive download as previously I just grabbed the files I needed for Android publishing from GS web link and it didn't include all SDKs etc.

    I still struggle to understand exactly what's needed and why during apk signing. If anyone could explain it to me I'd really appreciate it as I've tried to find a simple explanation but to no avail.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,934

    @cagrisavan it's going to take a while since we'll want to solve it for both Mac and Windows and the windows build is going take a bit. I will say that even if you have the update, you will still need to know where apksigner is (as we'll be pointing to the Google provided tools).

    So let's solve this here so you can get going and not have to wait.

    So things to check first:

    1) Have you installed Android Studio? https://developer.android.com/studio

    2) Have you installed Android SDK Build tools? Here are some instructions: https://developer.android.com/studio/intro/update#sdk-manager

    3) Okay, now that you have build tools, try to find apksigner.

    • If you are on MacOS:
    find ~/Library/Android/sdk -name apksigner
    
    • If you are on Windows:
    dir C:\Users /s | findstr /i apksigner.bat
    

    Let us know how the steps go (I'm making this troubleshooting session public to help other people in the same predicament. If you need some more real-time help and you're in a time-zone near CDT, then you can also chat with our team on the support chat box.

  • pinkio75pinkio75 Member, PRO Posts: 971

    Make a dir with all objects that you need to sign the app.

    1) i've just download the 28.0.3 tools.

    2) i've put the unsigned.apk app and my keystore in the same directory where are all command tools.

    3) after i just launch the terminal and follow the @adent42 instructions.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,934
    edited May 18

    Also, if you don't want Android Studio, you can just directly download the tools here:

    https://androidsdkmanager.azurewebsites.net/Buildtools.

    You can then unzip them and you'll know where everything is.

  • pinkio75pinkio75 Member, PRO Posts: 971
    edited May 19

    @cagrisavan you need to are inside a dir where are located all command tools

    So open your terminal and write cd "your directory"

    for example i've download the 28.0.3 dir in my desktop so i write in the terminal:

    cd desktop

    after

    cd android-9

    and after i write the command line tools:

    zipaligned

    and after

    apksigner.

    Honestly i've spend a 2 hours before to sign my apk apps because i need to update my java sdk but now the process is really simple.

    Anyway i hope that GS fix the process soon as possible.

  • angellalanaangellalana Member, PRO Posts: 1

    I finally got it!

    I have downloaded and installed Android Studio (https://developer.android.com/studio)

    2nd I have updated it (Android Studio> Check for Updates)

    3rd I have copied the two files (the signed apk downloaded from gamesalad and the *.keystore) to the same build-tools folder.

    4th I have copy-pasted and executed the command in Terminal, but I had problems there, since every time I tried, I got the same error: the directory did not exist. So I have checked that the path is correct (using: find ~ / Library / Android / sdk -name apksigner)

    5th Once the path and names of my files are correct ... everything has worked. The NEW file generated (*. apk_zipaligned.apk) has been perfectly supported by Google Play Console

  • pinkio75pinkio75 Member, PRO Posts: 971
    edited May 19

    @adent42 today i've generated two android games with RC but the musics files in the apk are not present!

    i think that probably the .m4a music files are missed in the build process...

    could you please check this issue?

    Thanks.

  • indra.azizindra.aziz Member, PRO Posts: 89

    I tried the steps today on Windows,

    Put both my unsigned apk and keystore file in the build-tool folder.

    input first command in terminal, but it says "unable to open 'nameofmyapp' as zip archive

    What am I doing wrong?

  • fruitjuiceproductions.mbfruitjuiceproductions.mb Member Posts: 13

    Hi, I just did everything but still got "(No such file or directory)"

    this is my code:

    ~/Library/Android/sdk/build-tools/29.0.3/zipalign -v 4 quizpro.apk quizpro_zipaligned.apk

    ~/Library/Android/sdk/build-tools/29.0.3/apksigner sign --ks quizpro.keystore --in quizpro_zipaligned.apk --out quizprogame.apk

    don't know what to do...

    thanks!

  • weaselpopgames2020weaselpopgames2020 Member, PRO Posts: 8

    @fruitjuiceproductions.mb it looks very close. Whenever you insert your file info (quizpro.apk) to replace <these>, drag it into terminal. It should show the whole path to the file (Users/etc/etc/quizpro.apk). Then whenever you create your zipaligned.apk or your final .apk, make sure you have it going to same directory (Users/etc/etc/yournewfile). Do it in 2 steps, run command to create zipaligned.apk, then run 2nd command to sign. Make sure to drag your keystore into terminal also. It works, but it was tricky for a non techie like me. Hope this helps you

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,934

    @fruitjuiceproductions.mb 29.0.3 might not be the correct directory. Use the "find" command above and it should help you. If it does not, make sure you have installed Android Studio and build tools. If you don't want to download android studio, you can download just the build tools in the link i post above and then you will know where the tools are when you unzip them.

  • indra.azizindra.aziz Member, PRO Posts: 89

    Sorry for double post, I can't to edit my previous one to add the command.

    I tried this command in terminal but got unable to open as zip archive

    C:\Users\Indra Aziz>AppData\Local\Android\Sdk\build-tools\29.0.3\zipalign.exe -v 4 Kordi_Ukulele_unsigned Kordi_Ukulele_unsigned_zipaligned.apk

    Unable to open 'Kordi_Ukulele_unsigned' as zip archive

    The downloaded unsigned apk is in the the build tool folder

  • pinkio75pinkio75 Member, PRO Posts: 971

    @adent42 hi about music issue ok now it works thank you!

  • fruitjuiceproductions.mbfruitjuiceproductions.mb Member Posts: 13

    @weaselpopgames2020 thank you! finally made it draging all the files in the terminal, thank you so much!

  • ArmellineArmelline Member, PRO Posts: 4,971

    Might be other issues, but at a minimum it should be:


    C:\Users\Indra Aziz>AppData\Local\Android\Sdk\build-tools\29.0.3\zipalign.exe -v 4 Kordi_Ukulele_unsigned.apk Kordi_Ukulele_unsigned_zipaligned.apk

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,934

    @indra.aziz

    are you in the directory with the APK file (probably the download directory).

    If not, then the command might not quite be right. This might work:

    C:\Users\Indra Aziz\AppData\Local\Android\Sdk\build-tools\29.0.3\zipalign.exe -v 4 C:\Users\Indra Aziz\Downloads\Kordi_Ukulele_unsigned.apk C:\Users\Indra Aziz\Downloads\Kordi_Ukulele_unsigned_zipaligned.apk

    The idea is, if you didn't change directories after opening the CMD window, then the file isn't there to process. You need to put the path to the file wherever it is on the drive OR change directories there. I assume the CMD shell default is your home dir so you'll need to cd Downloads (or wherever you downloaded the file).

  • ArmellineArmelline Member, PRO Posts: 4,971
    edited May 21
  • ArmellineArmelline Member, PRO Posts: 4,971
    edited May 21

    And here's a super crude super quick AppleScript application that'll do the legwork for you. Be sure zipalign and apksigner are in the same directory. It'll name exported files with the date and time, and if you get your keystore password wrong it'll just fail with a wall of text. I accept no responsibility for anything that happens as a result of use of this app.

    This is the source so you can compile it youself if you want to be sure it isn't stealing your passwords. Been yonks since I did any Applescript so hopefully it's not too cringeworthy...

    https://pastebin.com/b5JQCELT

  • indra.azizindra.aziz Member, PRO Posts: 89

    Thank you @adent42 @Armelline

    The first command worked I think, but the second one didn't work for me it says failed to load signer, and cannot find the keystore. Here is the screen of the cmd.

    I have the keystore file in both the downloads folder and the build-tools folder.

  • stragstrag Member, PRO Posts: 602
  • ArmellineArmelline Member, PRO Posts: 4,971

    It's looking for the keystore in the folder C:\Users\Indra Aziz\ since you didn't tell it to look elsewhere. Either give it the path to the keystore, or put the keystore in that folder (as that's where you're running the command from). Same goes for the unsigned apk.

  • ah4000ah4000 Member, PRO Posts: 7

    After 7 days of messing with this, i think i've given up. I finally got the first command to work, and then received the same error message "failed to load signer". Every command was put in properly and everything was in the same folder. Any ballpark figure of when the GS tool will be updated? Thanks

Sign In or Register to comment.