Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save simsam7/9514117 to your computer and use it in GitHub Desktop.
Save simsam7/9514117 to your computer and use it in GitHub Desktop.
Compiling release APK for Android using Cordova
Had some 'fun' doing this the first time around, so posting it here for myself & hopefully will help others too :-)
Not going into all the details, you should have Cordova, Android SDK, etc installed, your app created & tested etc, this is for the point where you want to submit your glorious new shiny app to the Google Play Store and you suddenly realize that you're running into things like, how to get a release APK created using Cordova.
1. Create a key if you don't have one, e.g. http://developer.android.com/tools/publishing/app-signing.html#cert
2. Alter your ...\platforms\android\AndroidManifest.xml, set debuggable to false:
android:debuggable="false"
3. Create file 'custom_rules.xml' under platforms\android, put this in there:
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules" default="help">
<property file="secure.properties" />
</project>
4. Create the 'secure.properties' file in same folder, put this in there (replace with your key details, note forward slashes). You obviously do not want this hanging around, but it's useful while you're in a final release cycle:
key.store=C:/Users/Sam/Documents/CODE/android-key/release-key.keystore
key.store.password=YOURPASSWORDHERE
key.alias=YOURALIASHERE
key.alias.password=YOURPASSWORDHERE
5. Compile the app with the --release option
cordova build android --release
6. The apk under the \platforms\android\bin folder should say 'release' somewhere, or else it isn't...
7. Submit the apk :-)
I know there are other recipes out there for doing this, but this is what worked for me and it's fairly painless.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment