If there is official cordova documentation for this, I couldn't find it and would appreciate a link. I have run cordova run android
to deploy to my phone. Things look good. Now I'm ready to turn this into an official app that users can download on the android play store? When I build my app it generates a file named "CordovaApp-debug.apk". That "debug" part makes me think this is the wrong file to work with, but I'm not sure how to generate the right file.

- 62,768
- 50
- 234
- 356
-
1http://stackoverflow.com/questions/20402818/build-android-release-apk-on-phonegap-3-x-cli Hope to help you – Andreas Weswaldi Dec 12 '14 at 00:44
-
@AndreasWeswaldi I'm hoping that will work, although the answer is a little dated and about PhoneGap as opposed to Cordova. It will *probably* still work the same way, though. Thanks – Daniel Kaplan Dec 12 '14 at 00:47
-
That question may be dated, but the information is still relevant. – sherb Dec 12 '14 at 02:11
-
you have sign in the apk inorder to release in play store – Mohammed Imran N Dec 12 '14 at 05:44
-
@sherb Cool. I'll try it tomorrow. Feel free to close this question. I'm going to keep it around so the answer is easier to google. – Daniel Kaplan Dec 12 '14 at 08:20
1 Answers
Deploying a hybrid app to the Google Play Store
These steps would work for Cordova, PhoneGap or Ionic. The only difference would be, wherever a call to cordova
is placed, replace it with phonegap
or ionic
, for your particular scenario.
Once you are done with the development and are ready to deploy, follow these steps:
Open a command line window (Terminal on macOS and Linux OR Command Prompt on Windows).
Head over to the /path/to/your/project/, which we would refer to as the Project Root.
While at the project root, remove the "Console" plugin from your set of plugins.
The command is:cordova plugin rm cordova-plugin-console
While still at the project root, use the cordova build command to create an APK for release distribution.
The command is:cordova build --release android
The above process creates a file called
android-release-unsigned.apk
in the folderProjectRoot/platforms/android/build/outputs/apk/
Sign and align the APK using the instructions at https://developer.android.com/studio/publish/app-signing.html#signing-manually
At the end of this step the APK which you get can be uploaded to the Play Store.
Note: As a newbie or a beginner, the last step may be a bit confusing as it was to me. One may run into a few issues and may have some questions as to what these commands are and where to find them.
Q1. What are jarsigner and keytool?
Ans: The Android App Signing instructions do tell you specifically what jarsigner and keytool are all about BUT it doesn't tell you where to find them if you run into a 'command not found error' on the command line window.
Thus, if you've got the Java Development Kit(JDK) added to your PATH variable, simply running the commands as in the Guide would work. BUT, if you don't have it in your PATH, you can always access them from the bin folder of your JDK installation.
Q2. Where is zipalign?
Ans: There is a high probability to not find the zipalign command and receive the 'command not found error'. You'd probably be googling zipalign and where to find it?
The zipalign utility is present within the Android SDK installation folder. On macOS, the default location is at, user-name/Library/Android/sdk/
. If you head over to the folder you would find a bunch of other folders like docs
, platform-tools
, build-tools
, tools
, add-ons
...
Open the build-tools
folder. cd build-tools
. In here, there would be a number of folders which are versioned according to the build tool-chain you are using in the Android SDK Manager. ZipAlign is available in each of these folders. I personally go for the folder with the latest version on it. Open Any.
On macOS or Linux you may have to use ./zipalign
rather than simply typing in zipalign
as the documentation mentions. On Windows, zipalign
is good enough.

- 566
- 5
- 13
-
The Android docs you reference no longer mention zipalign or jarsigner, but that page does mention keytool. – Luke Jun 23 '21 at 18:59
-
@Luke things might have changed over the past few years as I haven't been working on Cordova recently. I can probably look it up on the weekend or the near future and update my answer. Thank you for bringing this to my notice. :) – incorelabs Jun 23 '21 at 19:13