Speed up ADF Mobile Deployment to Android with Keystore and "Release" Packaging

As you might have noticed from my latest ADF Mobile entries, I'm doing most of my ADF Mobile development on a windows machine and testing on an Android device. Unfortunately the Android/windows experience is not as fast as the iOS/Mac one.

However, there is one thing I learned today that can make this a bit less painful in terms of the speed to deploy and test your application - and this is to use the "Release" mode when deploying your application instead of the "Debug" mode.

To do this you'll first need to define a keystore, but as Joe from our Mobile team showed me today, this is quite easy.

Here are the steps:

Open a command line in your JDK bin directory (I just used the JDK that comes with the JDeveloper install).

Issue the following command:

keytool –genkey –v –keystore <Keystore Name>.keystore –alias <Alias Name> -keyalg RSA –keysize 2048 –validity 10000

Both keystore name and alias names are strings that you decide on.

The keytool utility will then prompt you with various questions that you'll need to answer.

Once this is done, the next step is to configure your JDeveloper preferences->ADF Mobile to add this keystore there under the release tab:

 Then for your application specific deployment profile - switch the build mode from debug to release.

The end result is a much smaller mobile application (for example from 60 to 21mb) and a much faster deployment cycle (for me it is about twice as fast as before).


i am unable to run the keytool –genkey –v –keystore <Keystore Name>.keystore –alias <Alias Name> -keyalg RSA –keysize 2048 –validity 10000

as i do not see genkey as a valid option of keytool in my system. how to fix it?

Posted by Vik on February 04, 2013 at 11:07 PM PST #

Vik - I'm not sure why it doesn't work for you - make sure you are using JDK 6.
You can also try to use genkeypair instead of genkey.

Posted by Shay on February 05, 2013 at 09:59 AM PST #

Thanks !

Your post was very helpful !


Posted by guest on May 03, 2013 at 04:01 AM PDT #

How to enable log in IOS ?

Posted by guest on May 06, 2013 at 10:46 AM PDT #

Hi, I did this and in fact it was 50% faster, but still takes a little longer than android and eclipse, plus de apk size is way to big, How can we put it in the market with such size, is there another way? thanks!!

Posted by guest on May 09, 2013 at 10:15 PM PDT #

Guest - For even faster deployment on Android - deploy to a device instead of the emulator.
As for size of the apk file there is a minimum size of 9mb that is needed for the JVM. Frankly I don't think this is an issue for people on the store - angry birds is bigger than this and they didn't have any problems getting millions of users to download their application.

Posted by Shay on May 10, 2013 at 10:35 AM PDT #

Hi vik,

I am also getting same problem ûgenkey is that not a legal command.

how to resolve..

Posted by guest on September 11, 2013 at 07:17 AM PDT #

guest - this will depend on the JDK version you are using.

Posted by Shay on September 11, 2013 at 03:44 PM PDT #

use this command
keytool -genkey -v -keystore <Keystore Name>.keystore -alias <Alias Name> -keyalg RSA -keysize 2048 -validity 10000
this problem for "-" use from above code or type again all "-"

Posted by guest on November 07, 2013 at 07:45 AM PST #

Hi, thanks for this valuable information. After trying this, the deployment time reduced from more than 40 minutes to just 5 minutes.

Thanks a lot. Cheers!!

Posted by Jignesh Koshti on February 02, 2014 at 11:17 PM PST #

Post is truly helpful.

Posted by guest on February 19, 2014 at 10:48 PM PST #

After creating the key and updating it in preferences, I am getting this error:

[10:15:49 PM] Signing application...
[10:15:52 PM] Aligning Android application file...
[10:15:52 PM] Command-line executed: "C:\Program Files\Android\adt-bundle-windows-x86_64\sdk\tools\zipalign" -f 4 "C:\Oracle\Middleware\Oracle_Home\jdeveloper\mywork\mywork\MyFirstMAF\deploy\Android1\MyFirstMAF.apk" "C:\Oracle\Middleware\Oracle_Home\jdeveloper\mywork\mywork\MyFirstMAF\deploy\Android1\aligned_apk.apk"
[10:15:52 PM] Shutting down Android Debug Bridge server...
[10:15:52 PM] Deployment cancelled.
[10:15:52 PM] ---- Deployment incomplete ----.
[10:15:52 PM] Cannot run program ""C:\Program Files\Android\adt-bundle-windows-x86_64\sdk\tools\zipalign"": CreateProcess error=2, The system cannot find the file specified
[10:15:52 PM] CreateProcess error=2, The system cannot find the file specified

Please help.

Posted by guest on July 09, 2014 at 09:54 AM PDT #

guest -
You should post this on the OTN discussion forum.
Do you actually have a zipalign program in that directory (C:\Program Files\Android\adt-bundle-windows-x86_64\sdk\tools\)?

If you move the Android SDK installation into a directory that doesn't have spaces in the path does it work better?

Posted by Shay on July 09, 2014 at 10:31 AM PDT #

hi ,
your post was really helpful.For thoese who are not getting genkey as valid option use:
keytool –genkeypair –v –keystore <Keystore Name>.keystore –alias <Alias Name> -keyalg RSA –keysize 2048 –validity 10000
I hope it will work because it worked for me

Posted by Anj on August 06, 2014 at 11:49 PM PDT #

Hello thanks for your enlightenment,Please when i tried the procedure you gave ,it generated a certificate key called omile.keystore on my jdk directly .I even followed the procedure on "http://docs.oracle.com/cd/E53569_01/tutorials/tut_jdev_maf_app/tut_jdev_maf_app.html" .But after doing as illustrated on my Jdeveloper 12c ,if i try to deploy my app on the android emulator for testing it gave me these Errors:

[05:57:57 PM] Signing application...
[05:57:57 PM] Command-line executed: ["C:\Oracle\Middleware\Oracle_Home\oracle_common\jdk\bin\jarsigner", -keystore, "C:\Program Files\Java\jdk1.7.0_11\bin\Omile.keystore", -storepass, madu123, -keypass, madu123, -digestalg, SHA1, -sigalg, MD5withRSA, "C:\JDeveloper\mywork\Employees\deploy\Omile\Employees.apk", Omile]
[05:57:57 PM] jarsigner: Certificate chain not found for: Omile. Omile must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
[05:57:57 PM] Command-line execution failed (Return code: 1)
[05:57:57 PM] Command-line executed: "C:\Oracle\Middleware\Oracle_Home\oracle_common\jdk\bin\jarsigner" -keystore "C:\Program Files\Java\jdk1.7.0_11\bin\Omile.keystore" -storepass madu123 -keypass madu123 -digestalg SHA1 -sigalg MD5withRSA "C:\JDeveloper\mywork\Employees\deploy\Omile\Employees.apk" Omile
[05:57:57 PM] Deployment cancelled.
[05:57:57 PM] ---- Deployment incomplete ----.
[05:57:57 PM] Deployment failed due to one or more errors returned by 'C:\Oracle\Middleware\Oracle_Home\oracle_common\jdk\bin\jarsigner'. The following is a summary of the returned error(s):
Command-line execution failed (Return code: 1)

Posted by guest on September 23, 2014 at 03:14 AM PDT #

guest - try and move your Omile.keystore to a directory that has no spaces in its path (so not under program files). This sometime throws off JDeveloper.

Posted by Shay on September 23, 2014 at 02:08 PM PDT #

Hey thanks a ton,your post is really helpful.For those who are not getting genkey then instead of it use genkeypair

keytool -genkeypair -v nikhil.keystore -alias nikhil -keyalg RSA -keysize 2048 -validity 10000

Above mentioned command works for me.


Posted by guest on September 03, 2015 at 04:04 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

I'm a Director of Product Management for Oracle's Cloud Development Tools and Frameworks.
Follow me:

« September 2016