X

Shay Shmeltzer's Oracle Development Tools Tips

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

Shay Shmeltzer
Director of Product Management - Oracle

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).




Join the discussion

Comments ( 18 )
  • Vik Tuesday, February 5, 2013

    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?


  • Shay Tuesday, February 5, 2013

    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.


  • guest Friday, May 3, 2013

    Thanks !

    Your post was very helpful !

    Yossi


  • guest Monday, May 6, 2013

    How to enable log in IOS ?


  • guest Friday, May 10, 2013

    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!!


  • Shay Friday, May 10, 2013

    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.


  • guest Wednesday, September 11, 2013

    Hi vik,

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

    how to resolve..


  • Shay Wednesday, September 11, 2013

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


  • guest Thursday, November 7, 2013

    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 "-"


  • Jignesh Koshti Monday, February 3, 2014

    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!!


  • guest Thursday, February 20, 2014

    Post is truly helpful.


  • guest Wednesday, July 9, 2014

    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.


  • Shay Wednesday, July 9, 2014

    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?


  • Anj Thursday, August 7, 2014

    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


  • guest Tuesday, September 23, 2014

    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)


  • Shay Tuesday, September 23, 2014

    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.


  • guest Thursday, September 3, 2015

    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.

    Cheers.


  • guest Monday, January 9, 2017

    Hi,

    I have this problem:

    keytool error: java.io.FileNotFoundException:liangwei.keystore.p12(access rejected)

    what shall I do?

    michael


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.