Guide | 13/06/2019

How to sign an Android mobile app (June 2019)

Every Android mobile app needs signing before publishing in Google Play. This handy guide was prepared by Apiffee team to lead you through this process. Follow all the steps carefully to achieve the success

Before you start, please note that the app signing process depends on the operating system you use and whether you have or don’t have a key.

1. Windows users with an existing key

  1. Download and install the Java SE Development Kit
  2. Add “keytool” and “jarsigner” files to system environment variables
    • Right-click “This PC” and select “Properties”
    • Click “Advanced system settings”
    • Click “Environment variables” on the “Advanced” tab
    • Select “Path” and click “Edit”
    • Click “New” and type the path to the JRE directory
    • Click “New” once again and type the path to the JDK directory
    • Click “OK” until you close all open windows
  3. Download and install Git for Windows (it contains Bash Shell which is needed to run signing scripts)
  4. During the installation make sure “Git Bash Here” is checked
  5. Choose the option “Use Git from Git Bash only”
  6. Continue the installation process without changing other options
  7. Download the unsigned .apk file generated with Apiffee
  8. Put it in the location of your choosing
  9. Put your keystore file with “.jks” format in the same location
  10. Download the script for signing with an existing key
  11. Put the script in the same location as your .apk file
  12. Create a folder named “build-tools”
  13. Download Android Build Tools for Windows
  14. Unzip the content of the downloaded package and move it into “build-tools” folder
  15. Double-click the script file you downloaded in step 10
  16. Answer Y when asked if you want to sign the .apk file with your own key
  17. Answer Y when asked if you wish to provide your own keystore file
  18. Prepare the password and alias for that key
    If you don’t have them or have no way to obtain them, proceed to section 2.
  19. Enter the name of the keystore file without “.jks” extension, e.g. MyKeystoreName.jks should be MyKeystoreName
  20. Enter the keystore alias parameter
  21. Answer Y if you wish to print out certificates in console, N if you want to continue without printing
  22. Type the name of the file generated with Apiffee without “.apk”, e.g. name_of_apk_file.apk should be typed as name_of_apk_file
  23. Enter the password for the keystore file
  24. The console should print out a bunch of logs and close
  25. There should be 1 new file in your directory: signed_apk_file.apk

    Congratulations! Now, you can start the process of publishing your app in Google Play

    Remember: !!!KEEP THE GENERATED FILE IN A SAFE LOCATION!!!

2. Windows users who need a new key

  1. Download and install the Java SE Development Kit
  2. Add “keytool” and “jarsigner” files to system environment variables
    • Right-click “This PC” and select “Properties”
    • Click “Advanced system settings”
    • Click “Environment variables” on the “Advanced” tab
    • Select “Path” and click “Edit”
    • Click “New” and add the path to the JRE directory
    • Click “New” once again and type the path to the JDK directory
    • Click “OK” until you close all open windows
  3. Download and install Git for Windows (it contains Bash Shell which is needed to run signing scripts)
  4. During the installation make sure “Git Bash Here” is checked
  5. Choose the option “Use Git from Git Bash only”
  6. Continue the installation process without changing other options
  7. Download the unsigned .apk file generated with Apiffee
  8. Put it in the location of your choosing
  9. Download the script for signing with a new key
  10. Put the script in the same location as your .apk file
  11. Create a folder named “build-tools”
  12. Download Android Build Tools for Windows
  13. Unzip the content of the downloaded package and move it into “build-tools” folder
  14. Double-click the script file you downloaded in step 10
  15. Answer Y when prompt whether you want to generate a key and sign the .apk file
  16. Prepare the following:
    • Application name
    • The .apk file
    • The password of your choosing (min. 6 characters)
    • First and last name
    • Name of your organizational unit (e.g. IT)
    • Name of your organization (e.g. MyCompanyName)
    • Name of your city or locality (e.g. Washington)
    • Name of your state or province (e.g. Texas)
    • Two letter code of your country (e.g. US)

      Remember: !!!KEEP THIS DATA SAVED IN A SAFE LOCATION!!!

  17. Answer Y when prompt if you want to generate a new keystore file
  18. Pass all the data prepared in step 15 and confirm with “yes”
  19. Press the “Enter/Return” button when asked to pass key password for your application
  20. Answer Y if you wish to print out certificates in console, N if you want to continue without printing
  21. Type the name of the file generated with Apiffee without “.apk”, e.g. name_of_apk_file.apk should be typed as name_of_apk_file
  22. Enter the password for the keystore file
  23. The console should print out a bunch of logs and end close
  24. There should be 2 new files in your directory:
    • Keystore file .jks
    • The file: signed_apk_file.apk

      Congratulations! Now, you can start the process of publishing your app in Google Play.

      Remember: !!!KEEP BOTH FILES IN A SAFE LOCATION!!!

3. Linux/MacOS users with an existing key

  1. Download and install the Java SE Development Kit
  2. Add Java to system variables
    • Check if JAVA_HOME is set
      • Open Console
      • Execute: echo $JAVA_HOME
    • If the output is a path, then Java is already added to system variables – skip to step 3
    • If the output is empty, then execute the following steps:
      • Execute: vi ~/.bashrc OR vi ~/.bash_profile
      • Add a line: export JAVA_HOME=/usr/java/jre1.6.0_04
      • Save the file
      • Source ~/.bashrc OR source ~/.bash_profile
      • Execute: echo $JAVA_HOME
      • The output should be a path. This means that Java is added to system variables – proceed to step 3
  3. Download the unsigned .apk file generated with Apiffee
  4. Put it in the location of your choosing
  5. Put your keystore file with “.jks” format in the same location
  6. Download the script for signing with an existing key
  7. Put the script in the same location as the .apk file
  8. Create a folder named “build-tools”
  9. Download Android Build Tools suitable for your operating system (Linux or MacOS)
  10. Unzip the content of the downloaded package and move it into “build-tools” folder
  11. Open Linux terminal with “ctrl+alt+t”
  12. Allow to run bash script, e.g. chmod +x .sh
  13. Go to the location of files, e.g. ~/Home/AndroidSigning/Files/ e.g. cd AndroidSigning/LocationOfExtractedFiles
  14. Run the script file, e.g. ./.sh
  15. Answer Y when asked if you want to sign the .apk file with your own key
  16. Answer Y when asked if you wish to provide your own keystore file
  17. Prepare the password and alias for that key
    If you don’t have them or have no way to obtain them, proceed to section 4.
  18. Enter the name of the keystore file without “.jks” extension, e.g. MyKeystoreName.jks should be MyKeystoreName
  19. Enter the keystore alias parameter
  20. Answer Y if you wish to print out certificates in console, N if you want to continue without printing
  21. Type the name of the file generated with Apiffee without “.apk”, e.g. name_of_apk_file.apk should be typed as name_of_apk_file
  22. Enter the password for the keystore file
  23. The console should print out a bunch of logs and end with “Signed apk generated”
  24. There should be 1 new file in your directory: signed_apk_file.apk.

    Congratulations! Now, you can start the process of publishing your app in Google Play

    Remember: !!!KEEP THE GENERATED FILE IN A SAFE LOCATION!!!

4. Linux/MacOS users who need a new key

  1. Download and install the Java SE Development Kit
  2. Add Java to system variables
    • Check if JAVA_HOME is set
      • Open Console
      • Execute: echo $JAVA_HOME
    • If the output is a path, then Java is already added to system variables – you can proceed to step 3
    • If the output is empty, then execute the following steps:
      • Execute: vi ~/.bashrc OR vi ~/.bash_profile
      • Add a line: export JAVA_HOME=/usr/java/jre1.6.0_04
      • Save the file
      • Source ~/.bashrc OR source ~/.bash_profile
      • Execute: echo $JAVA_HOME
      • The output should be a path. This means that Java is added to system variables – you can proceed to step 3
  3. Download the unsigned .apk file generated with Apiffee
  4. Put it in the location of your choosing
  5. Download the script for signing with a new key
  6. Put the script in the same location as the .apk file
  7. Create a folder named “build-tools”
  8. Download Android Build Tools suitable for your operating system (Linux or MacOS)
  9. Unzip the content of the downloaded package and move it into “build-tools” folder
  10. Open Linux terminal with “ctrl+alt+t”
  11. Allow to run bash script, e.g. chmod +x .sh
  12. Go to the location of files, e.g. ~/Home/AndroidSigning/Files/ e.g. cd AndroidSigning/Files
  13. Run script file, e.g. ./.sh
  14. Answer Y when asked if you want to generate key and sign the .apk file
  15. Prepare the following:
    • Application name
    • The .apk file
    • The password of your choosing (min. 6 characters)
    • First and last name
    • Name of your organizational unit (e.g. IT)
    • Name of your organization (e.g. MyCompanyName)
    • Name of your city or locality (e.g. Washington)
    • Name of your state or province (e.g. Texas)
    • Two letter code of your country (e.g. US)

      Remember: !!!KEEP THIS DATA SAVED IN A SAFE LOCATION!!!

  16. Answer Y when asked if you want to generate a new keystore file
  17. Pass all data prepared in step 14 and confirm with “yes”
  18. Press the “Enter/Return” button when asked to pass key password for your application
  19. Answer Y if you wish to print out certificates in console, N if you want to continue without printing
  20. Type the name of the file generated with Apiffee without “.apk”, e.g. name_of_apk_file.apk should be typed as name_of_apk_file
  21. Enter the password for the keystore file
  22. The console should print out a bunch of logs and end with “Signed apk generated”
  23. There should be 2 new files in your directory:
    • Keystore file .jks
    • The file: signed_apk_file.apk

      Congratulations! Now, you can start the process of publishing your app in Google Play.

      Remember: !!!KEEP BOTH FILES IN A SAFE LOCATION!!!

Apiffee your website FOR FREE!

Apiffee logo with white letters

mobile app
generator

Contact icon

contact@apiff.ee

Tel: +48 577 757 721