<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Guguweb - app</title><link href="https://www.guguweb.com/" rel="alternate"></link><link href="https://www.guguweb.com/feeds/app.atom.xml" rel="self"></link><id>https://www.guguweb.com/</id><updated>2022-01-07T15:58:03+01:00</updated><subtitle>Freelance developer and sysadmin</subtitle><entry><title>How to automatically sign your Android apk using Ionic framework and Crosswalk</title><link href="https://www.guguweb.com/2015/05/20/how-to-automatically-sign-your-android-apk-using-ionic-framework-and-crosswalk/" rel="alternate"></link><published>2015-05-20T10:11:18+00:00</published><updated>2022-01-07T15:58:03+01:00</updated><author><name>Augusto Destrero</name></author><id>tag:www.guguweb.com,2015-05-20:/2015/05/20/how-to-automatically-sign-your-android-apk-using-ionic-framework-and-crosswalk/</id><summary type="html">&lt;p&gt;I discovered a simple trick that can be a great time saver when you are building your app using &lt;a href="http://ionicframework.com/" target="_blank" rel="noopener noreferrer"&gt;Ionic Framework&lt;/a&gt; and the &lt;a href="https://crosswalk-project.org/" target="_blank" rel="noopener noreferrer"&gt;Crosswalk web view&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In few steps you&amp;#8217;ll be able to automate the production of release signed apks of your app, ready to be published on the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I discovered a simple trick that can be a great time saver when you are building your app using &lt;a href="http://ionicframework.com/" target="_blank" rel="noopener noreferrer"&gt;Ionic Framework&lt;/a&gt; and the &lt;a href="https://crosswalk-project.org/" target="_blank" rel="noopener noreferrer"&gt;Crosswalk web view&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In few steps you&amp;#8217;ll be able to automate the production of release signed apks of your app, ready to be published on the Google Play Store.&lt;/p&gt;
&lt;p&gt;If you are developing an hybrid mobile app using the awesome &lt;a href="http://ionicframework.com/" target="_blank" rel="noopener noreferrer"&gt;Ionic Framework&lt;/a&gt; and you are targeting the Android platform, I strongly suggest you to use the &lt;a href="https://crosswalk-project.org/" target="_blank" rel="noopener noreferrer"&gt;Crosswalk web view&lt;/a&gt; for your app.&lt;/p&gt;
&lt;p&gt;The most important advantage using Crosswalk is a consistent platform to deal with, if you don&amp;#8217;t like to fix bugs arising from the fragmentation of Android webviews.&lt;/p&gt;
&lt;p&gt;Using Crosswalk in your Ionic project is as easy as typing this command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$ ionic browser add crosswalk&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ionic will take care of setting the building environment for you.&lt;/p&gt;
&lt;p&gt;When you want to publish your app on the Google Play Store you have to build the apk in release mode, sign it with a key of your keystore and zipalign the package to optimize it.&lt;/p&gt;
&lt;p&gt;Creating the keystore is out of scope of this howto, you can find all the details in the &lt;a href="http://ionicframework.com/docs/guide/publishing.html" target="_blank" rel="noopener noreferrer"&gt;Ionic Documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;All of these steps can be automated by creating a file named &lt;em&gt;release-signing.properties&lt;/em&gt; with your favorite text editor (vi in my case) in your &lt;em&gt;platforms/android/&lt;/em&gt; directory.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;cd platforms/android/&amp;lt;br /&amp;gt;
vi release-signing.properties&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In that file you can put only two lines:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;storeFile=/path/to/keystore/yourname.keystore&amp;lt;br /&amp;gt;
keyAlias=youralias&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Of course you have to modify the path to your keystore file and the alias of your key.&lt;/p&gt;
&lt;p&gt;Then you can build your release apk with the command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$ ionic build --release android&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;A little window will appear asking for the keystore password and the key password. If you don&amp;#8217;t want to type the two passwords all times you can write them in the &lt;em&gt;release-signing.properties&lt;/em&gt; files, adding two lines similar to the following:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;storePassword=your_keystore_password&amp;lt;br /&amp;gt;
keyPassword=your_key_password&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;But I suggest to keep your password secret and avoid writing them in a clear text file.&lt;/p&gt;
&lt;p&gt;At the end of the build you&amp;#8217;ll find your apks in the &lt;em&gt;platforms/android/build/outputs/apk/&lt;/em&gt; directory. With this setup you should find two apks named &lt;em&gt;android-x86-release.apk&lt;/em&gt; and &lt;em&gt;android-armv7-release.apk&lt;/em&gt; there.&lt;/p&gt;
&lt;p&gt;Remember that you have to upload both x86 and armv7 apks to the Play Store, because using Crosswalk your app contains native code which is architecture specific.&lt;/p&gt;
&lt;p&gt;Remember to activate the &amp;#8220;Advanced mode&amp;#8221; in your Developer Console (if you are in &amp;#8220;Simple mode&amp;#8221; only one apk at a time can be activated) and upload one apk after the other. Google will be clever enough seeing that the apks target two different platforms. For more details on the topic see the &lt;a href="http://developer.android.com/google/play/publishing/multiple-apks.html" target="_blank" rel="noopener noreferrer"&gt;Android documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Thanks to baleboy who pointed out in the comments the need to upload both apks to the store.&lt;/p&gt;</content><category term="mobile"></category><category term="android"></category><category term="app"></category><category term="crosswalk"></category><category term="ionic"></category></entry></feed>