Ionic toturial for building a release.apk


#35

why my build erro like this


#36

I also have same error. Please give solution. @nicraboy


#37

@nicraboy

Having following error while building project. I am using Ubuntu.

pc181@pc181-desktop:/var/www/html/ionic/myMap$ ionic build android
Running command: /var/www/html/ionic/myMap/hooks/after_prepare/010_add_platform_class.js /var/www/html/ionic/myMap
add to body class: platform-android
Running command: /var/www/html/ionic/myMap/platforms/android/cordova/build
[Error: ‘ANDROID_HOME’ environment variable is set to non-existent path: /home/dquintana/Android/Sdk
Try update it manually to point to valid SDK directory.]
ERROR building one of the platforms: Error: /var/www/html/ionic/myMap/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /var/www/html/ionic/myMap/platforms/android/cordova/build: Command failed with exit code 2
** at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)**
** at ChildProcess.emit (events.js:110:17)**
** at maybeClose (child_process.js:1015:16)**
** at Process.ChildProcess._handle.onexit (child_process.js:1087:5)**


#38

Let me know which approach is the best one to sign and zipalign my app


#39

I tried various approach to sign and zipalign
For example

  1. Ant.properties file setting

  2. Manual processs
    $ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name

Apk file generated but not signed one, I am not getting any errorr

Please provide best workable solutions.

Thanks


#40

Hi @nicraboy. I followed this tutorial for android release.apk and everything worked fine until the --release command. An error came up and suggested that I might not have the required environment or os to build this project. Is this because I did this on a mac?

Here is the error that came up:

Running command: “/Users/LiyangFeng/Desktop/local notification/hooks/after_prepare/010_add_platform_class.js” "/Users/LiyangFeng/Desktop/local notification"
add to body class: platform-android
Running command: “/Users/LiyangFeng/Desktop/local notification/platforms/android/cordova/build” --release
[Error: ANDROID_HOME is not set and “android” command not in your PATH. You must fulfill at least one of these conditions.]
ERROR building one of the platforms: Error: /Users/LiyangFeng/Desktop/local notification/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/LiyangFeng/Desktop/local notification/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)


Issue to have signed apk after creating build.json file and feeling details as- Error: Unexpected token / in JSON at position 0
#41

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

Regards,


#42

You should no longer use ant.properties and secure.properties you should create a “release-signing.properties” file with these contents:

key.store=YourApp.keystore
key.store.password=
key.alias=YourApp
key.alias.password=

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

You should no longer use ant.properties and secure.properties you should create a
"release-signing.properties" file with these contents:

key.store=YourApp.keystore
key.store.password=
key.alias=YourApp
key.alias.password=
no custom-rules.xml just the release-signign.properties and the key.store file
then use ionic build --release


#43

Where exactly does this release-signing.properties 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:


#44

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…


#46

hi…!
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?


#47

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


#48

@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”.


#49

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


#50

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 com.android.tools.build:gradle:1.5.0.
Required by:
android:CordovaLib:unspecified
Could not HEAD ‘https://repo1.maven.org/maven2/com/android/tools/buil
d/gradle/1.5.0/gradle-1.5.0.pom’.
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.
useDeprecatedNdk=true"

Somebody please help


#51

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


#52

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


#53

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?


#54

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
#55

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.