- If you like this project, please consider giving it a star (*) and follow me at GitHub & YouTube.
How to publish Angular app to Google Play Store using Cordova
click here for video tutorials!
This github repository is a documentation on how to publish an Angular 6.0/react JS or any HTML, JavaScript app to Google play store using Apache Cordova Framework.
https://cordova.apache.org/docs/en/latest/
Before you start, if you don't already have, please download and Install android studio and configure sdk tools from https://developer.android.com/studio/
make sure android licenses are accepted
make sure android path/environment variables are setup properly
** for iOS development, you will need a mac machine with latest XCODE installed.
** Let's get started
$ cordova -v // check if 8.0.0 or latest cordova version is installed
if cordova is not installed or you have an older version
$ npm install -g cordova
$ cordova create mnjic com.elishconsulting.mnjic Mnjic
create a new cordova app
< cordova create appname com.domain.project appname >
$ cd mnjic // once app is created, browse into new app folder
$ cordova platform add browser // add platform browser
$ cordova platform add android // add platform android
$ cordova platform add ios // add platform ios
$ cordova plaform ls // list all platforms
install jdk and make sure JAVA_HOME is setup properly
On windows machine, please make sure SYSTEM > Env Variables JAVA_HOME and ANDROID_HOME are set properly
$ which java
$ java -version
$ export JAVA_HOME=/Library/Java/Home
$ echo $JAVA_HOME
$ echo $ANDROID_HOME
$ export ANDROID_HOME=~/Library/Android/sdk
$ export PATH=${PATH}:/Library/Android/sdk/platform-tools:/Library/Android/sdk/tools
$ echo $ANDROID_HOME
$ echo $PATH
$ cordova requirements
in some case, if may ask you to update Android SDK through Android Studio.
and install gradle.
$ java -version
java version "1.8.0_121"
install gradle https://gradle.org/install/
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ install brew
$ brew install gradle
config.xml changes (make sure < android > setting are changed)
please see this github repo for config.xml sample
apply following changes
favicon.ico www -> replace directory, (back up index.html)
res -> icons// replace icons
$ cordova run browser
$ cordova build android
cordova build will create an unsigned app-debug.apk, You can copy this apk file to any real android device and test your app.
/Users/amitshukla/documents/mnjic1/platforms/android/app/build/outputs/apk/debug/app-debug.apk
$ cordova run android
if emulator is slow for any reason, please skip this and generate android debug.apk file.
keytool -genkey -v -keystore mnjic.keystore -alias mnjic -keyalg RSA -keysize 2048 -validity 10000
Sign app
cordova run android --release -- --keystore=mnjic.keystore --storePassword=abcd --alias=mnjic --password=abcd
this command above will generate same entries as below mentioned in build.json
{ "android": { "debug": { "keystore": "../android.keystore", "storePassword": "android", "alias": "mykey1", "password" : "password", "keystoreType": "" }, "release": { "keystore": "../android.keystore", "storePassword": "", "alias": "mykey2", "password" : "password", "keystoreType": "" } } }
// build with release flag will generate a final app file which can be submitted to Google Play Store.
/Users/amitshukla/documents/mnjic1/platforms/android/app/build/outputs/apk/debug/app-release.apk
Prepare Google PlayStore ScreenShot
Publish to Google Play Store
** In case, if you are releasing an updated release on your app.
Do NOT forget to change version code on next time your build your app (--release).