Releasing Ionic app on Android


#1

Where are there accurate, recent instructions for publishing my Ionic 2 app on the Google Play store. I don’t see anything in the docs or immediately catering to this on the forums, but I probably missed it.

D


#2
cordova plugin rm cordova-plugin-console

cordova build --release android

keytool -genkey -v -keystore my-keystore-file.keystore -alias EMAIL/PACKAGE_NAME/UNIQUE_ID -keyalg RSA -keysize 2048 -validity 10000

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore PATH_TO/my-keystore-file.keystore platforms/android/build/outputs/apk/android-release-unsigned.apk EMAIL/PACKAGE_NAME/UNIQUE_ID

~/Library/Android/sdk/build-tools/23.0.0/zipalign -v 4 platforms/android/build/outputs/apk/android-release-unsigned.apk signed_releases/APP_NAME_$(date +%F).apk

You only need to generate your keystore the first time (third command), keep that file on a safe place!
Customize the paths I use to your own ones and you should be able to generate your signed apk.


#3

you can also use this one-liner if you already have a key in your keystore.jks:
ionic build android --release -- --keystore="../android.keystore" --storePassword=android --alias=mykey --password=myKeyPassword

see cordova help build and/or cordova docs for detailed information


Steps for preparing Ionic 2 app for Play Store
#4

this is the best guide

http://ionicframework.com/docs/guide/publishing.html

Be really carefull with your keystore, if you lose it, you won’t be able to update the app


#6

It looks like Ionic1 and not Ionic2


#7

There is no difference for this task.


#8

thanks very much that very help for me


#9

this one liner worked for me in the past but i came after two months (now may 2017) back to my project and its generating only unsigned apk any known reason?


#10

Sorry man, no idea. I moved all my builds (android and iOS) to the ionic cloud.
Android works for development and production, iOS only development …


#11

really interesting so maybe i should also consider ionic cloud…
interesting so you helped me


#12

For development builds I use:

- export IONIC_PACKAGE_BUILD_RELEASE="false"
- export IONIC_PACKAGE_BUILD_PROFILE="xxxx"
- ./sh/ionic-login.sh
- npm run build
- ./sh/ionic-package.sh android
- ./sh/ionic-package.sh ios

IONIC_PACKAGE_BUILD_PROFILE is the name of your profile in the ionic cloud.

ionic-login.sh: https://github.com/marcoturi/ionic-boilerplate/blob/master/sh/ionic-login.sh

and ionic-package.sh I adapted like this:

...
  if [ -z "$1" ]; then
    fail "ionic-package: specify either 'ios' or 'android' as parameter of the script"
  fi

  # Command arguments
  args="$1"
...

HTH :slight_smile:


#13

A post was split to a new topic: Keystore file does not exist