@encodedmirko : Thanks buddy, This is my first mobile app. Had no idea what signing is and all.
So you create this file under platforms/android? And you donât need to do any of the previous steps outlined in the first post?
Not entirely, you still have to step 1, 2 and 3 @TacoBot
We store those in a secure place and privately document how to retrieve for other developers on the team. In my project, when I get those files I put them in a config
folder with a rule in version control to ignore those files (so they never get added to any repo by accident). I have a hooks script that copies the files into platforms/android
only when doing a release build.
With the new cordova version itâs possible to simply add a build.json and get everything done automatically:
{
âandroidâ: {
âdebugâ: {
âkeystoreâ: ââŚ\android.keystoreâ,
âstorePasswordâ: âandroidâ,
âaliasâ: âmykey1â,
âpasswordâ : âpasswordâ,
âkeystoreTypeâ: ââ
},
âreleaseâ: {
âkeystoreâ: ââŚ\android.keystoreâ,
âstorePasswordâ: ââ,
âaliasâ: âmykey2â,
âpasswordâ : âpasswordâ,
âkeystoreTypeâ: ââ
}
}
}
see https://cordova.apache.org/docs/en/5.0.0/guide_platforms_android_tools.md.html
Cheers
Hello @sjerd , You can not say add this line inside the tag to your custom_rules.xml. Because custom_rules.xml has many tags inside it which one exactly you mean??
Regards,
I placed a comment on july 4 That you should read, ionic changed their build process a bit
Is there an updated thread for building release.apk?
It seems the process keeps changing every few months or so, thus someone new is going to be lost for sure.
@sjerdâs comment on July 4th is the correct solution. Just make sure you place the release-signing.properties
file in platforms/android/
.
@htv It has changed once because Android has switched from ant to Gradle for builds, so really it depends on which version of Cordova youâre currently using. IIRC, Cordova 5.x (latest) is using Gradle now. Im still using Cordova 4.3 so weâre still using ant, thus instructions will be different for ant vs. Gradle builds.
hi, @sjerd
Shall I follow this steps after doing it once? I updated my app code and want to build new release of same app.
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=<YourApp keystore password>
key.alias=YourApp
key.alias.password=<YourApp alias password>
no custom-rules.xml just the release-signign.properties and the key.store file
then use ionic build --release
make sure step by step but itâs not working. I saw error below:
Minifying JS file: ._ion.sound.js
/Users/phanthinh/Public/Projects/buddy/build/***/node_modules/uglify-js/tools/node.js:57
files.forEach(function(file, i){
^
TypeError: Cannot read property âforEachâ of undefined
at Object.exports.minify (/Users/***/Public/Projects/buddy/build/***/node_modules/uglify-js/tools/node.js:57:14)
at compress (/Users/***/Public/Projects/***/build/buddy/hooks/after_prepare/ionic-minify.js:63:29)
at /Users/***/Public/Projects/buddy/build/***/hooks/after_prepare/ionic-minify.js:119:11
at FSReqWrap.oncomplete (fs.js:82:15)
Error: Hook failed with error code 1: /Users/***/Public/Projects/buddy/build/buddy/hooks/after_prepare/ionic-minify.js
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:195:23
at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:797:24)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:823:30
at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:741:41)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at doNTCallback0 (node.js:408:9)
at process._tickCallback (node.js:337:13)
Awesome!! Itâs worked
why my build erro like this
I also have same error. Please give solution. @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)**
Let me know which approach is the best one to sign and zipalign my app
I tried various approach to sign and zipalign
For example
-
Ant.properties file setting
-
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
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)