When you finish your Android app coding and testing, if you want to publish it to the google play store, you should create a publishable app (.apk) file. This article will show you how to create a publishable app (.apk) file step by step.
1. Generate Publishable APK File Steps.
- Open Android Studio, click ” Build —> Generate Signed APK ” on the top toolbar menu.
- There will popup a dialog with the title Generate Signed APK. There are two sections in the dialog, Key store and Key.
- The Key store is a file that has the jks ( java key store ) file extension. This file will be used to save multiple different app keys.
- If you have multiple android apps, you can provide each app with one key.
- But it is best for you to use a single key to sign multiple Android apps because those apps signed with the same key can trust each other in communication. And it is easy to maintain.
- If you do not has an existing key store file, click the ” Create new…” button below the Key store path: textbox in the above Generate Signed APK dialog. There will pop up another dialog with the title New Key Store.
- You should select a Key store path with a key store file name (ie: C:\WorkSpace\dev2qa.com\androidExample.jks) and input a strengthened password for it. The key store file path must be an existing directory otherwise android studio will not create it for you.
- In the New Key Store dialog window Key section, input an alias name for the new key in the Alias input textbox. The alias can not include white space and punctuation. Make sure the alias is unique in both character and character cases if you have multiple keys with multiple aliases.
- Input a strong password for the newly generated key in the Key section Password input textbox.
- The default Validity ( years ) value is 25, which is enough for your APK file. Because Google play store’s rule requires your key must be valid before October 22, 2033.
- Input your information in the Key section —> Certificate area.
- Click the OK button. It will return to the ” Generate Signed APK ” dialog. And all the key store and key information have been inputted in that dialog accordingly also.
- Click the Next button, there will pop up another dialog. You can choose the APK Destination Folder and Build Type. The Build Type should be release in this example. Select at least one Signature Versions checkbox ( V1 (Jar Signature) or V2 (Full APK Signature)) at the bottom.
- Click the Finish button. Then you can get the publishable app APK release file (app-release.apk) in the android studio project folder. You can click here to see the detailed explanation for the Signature Version.
2. Build Android Debug APK File Steps.
- Open Android Studio, and click ” Build —> Build APK ” in the top toolbar.
- When the build process complete, there will popup a dialog at the right bottom of Android Studio. Click the link ( Show in Explorer )to open the folder where the APK file is created and saved.
- You can see a file named app-debug.apk in that folder (