Ionic toturial for building a release.apk


The tutorial is a year old. Apache Cordova no longer uses Ant. It won’t work now.



You should no longer use and you should create a “” file with these contents:

no custom-rules.xml just the and the file then use ionic build --release
only these steps if your ionic version is up to date

You should no longer use and you should create a
"" file with these contents:
no custom-rules.xml just the and the file
then use ionic build --release


Where exactly does this go?

I have ionic 1.2.4 and cordova-cli 6.0 with cordova-android 5.1.0 and each time I build, the file gets deleted from /path-to-my-app/platforms/android :sob:


I cannot get this to work, even with the newer gradle config. It complains “Keystore was tampered with, or password was incorrect” but I know thats not the case. I can upload that keystore onto ionic and use ionic package and it works fine. But I need to build a release version locally so I can force debug on, because for some reason when I make the release build my app can’t access its backend API which works fine in all other cases…


after completion of these steps i am unable to get signed apk instead i get unsigned apk
What more changes do i need to do?


how to create simple apk file in ionic framework using without any software


@sjerd Could you please update the original post with these instructions? There are almost 50 comments and I guess that not everyone reads all of them to find somewhere in between that half of the instructions in the original tutorial are obsolete. And this is still one of the top results in Google for “ionic build release”.


Yes but for some reason I can’t edit the original post. The edit button is missing.


Brother please help.
I am trying to build android using ionic from a week but not resolve below issue.

What went wrong:
A problem occurred configuring root project ‘android’.

A problem occurred configuring project ‘:CordovaLib’.
Could not resolve all dependencies for configuration ‘:CordovaLib:classpath
Could not resolve
Required by:
Could not HEAD ‘
peer not authenticated
Error: Error code 1 for command: cmd with args: /s,/c,"“E:\Ionic Development\MyI
rritatingP\platforms\android\gradlew” cdvBuildRelease -b “E:\Ionic Development\M
yIrritatingP\platforms\android\build.gradle” -Dorg.gradle.daemon=true -Pandroid.

Somebody please help


Try updating your android sdk tools had same kind of error.


Hello sjerd ,
Thanks for your instant reply… actually there was problem in environment variable. And I done it…
Thank you so much.


I followed steps given above for release apk. It created release apk file but when I try to install this in my mobile, it give me error “There is a Problem Parsing the Package.”. Please guide me what more need to change OR what is going wrong here?


anyone know where custom_rules.xml is? I did a project-wide search and did not find it.

Looking for help compiling my existing ionic app into an Android app

It uses another build method now, search this thread i’ve mentioned it a couple times. I also added the new method as an answer to this thread.


thanks a lot.
I am new to Ionic, I have an ionic app.
I have created build for that
ionic build android
and i got debug.apk
now I need Singed apk so that i can use it on play store.

I found this tutorial but it wont help me a lot.
What i have-

** ionic CLI v2.0.0-beta.31
java version "1.7.0_21",
cordova-  6.2.0,
node-   v6.2.2,
npm -v   3.9.5,**

=> I am unable to use Ionic toturial for building a release.apk to have some help,

=> then I follow this
=> also seen this

  1. create a file in project root directory with name build.json
  2. insert details as
    “android”: {
    “release”: {
    “keystore”: “android.keystore”,
    “storePassword”: “storepassword”,
    “alias”: “mykey”,
    “password” : “password”,
    “keystoreType”: “”
  3. run
    cordova build android --release

Now i have issue as-
Reading build config file: /Users/some/project/files/build.json
Error: Unexpected token / in JSON at position 0
Don’t know how to solve this and get signed apk for my app.


After typing that command line :
keytool -genkey -v -keystore YourApp.keystore -alias YourApp -keyalg RSA -keysize 2048 -validity 10000

I get that message on windows cmd:

‘keytool’ n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

Which means that keytool is not a recognized command.

May I have a help please?


Sorry but someone should say it… The title says “toturial” :stuck_out_tongue:
Goot tUto tho! :wink:


On running ionic build android --release i’m getting this eror

Total time: 3.55 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘android’.

You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 24].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Picked up _JAVA_OPTIONS: -Xmx512M


Are you sure your Android SDK is up-to-date? Try running android in your cmd and see if you need to install any packages.


i get the apk-release file but when i try to install on my phone it says install failed. any idea whats wrong?
previously when apk was not signed properly build used to fail but this time build passed means it was signed properly. I have no clue why install fails.