Thursday, May 30, 2013

Setup ADF Mobile on Android For Release Mode


Props go to Shay and Joe with the ADF Team at Oracle for this post.

If you have begun developing mobile apps with ADF Mobile on Windows, you have already begun deploying onto the Android Emulator and/or a physical Android Device on hand. To speed up the deployment process and overall performance of the ADF Mobile app, deploy your apps using Release Mode. Overall, you'll never get the android emulator to run like a physical device or like the iOS emulator, but you can improve the performance of apps by deploying them in Release Mode.

Below are steps to get your Android Apps running in Release mode (developed on a Windows PC). Essentially, you'll be creating a self-signed certificate with Java's keytool command and deploying apps based on your self-signed certificate.


  1. Open your command-line utility on Windows.
  2. Add the %JDK_Home%/bin directory to the front of your PATH environment variable.
    Note: the JDK Home should be the JDK Home which your JDeveloper is using.
  3. cd to a directory where you want store your self-signed certificate. I put it in the JDeveloper Home, for example C:\Oracle\JDeveloper
  4. Enter the following command to generate a self-signed certificate:
    keytool -genkey -v -keystore %Keystore_Name%.keystore -alias %Alias_Name% -keyalg RSA -keysize 2048 -validity 10000

    Replace %keystore_name% with the a

    ctual filename that you want to specify for the keystore
    Replace %Alias_Name%  with the alias name you want to specify. Since it's a self-signed certificate, you can name this whatever you want.
  5. You'll be prompted to specify keystore passwords and additional certificate fields. When you're prompted to enter an alias-key password, just hit enter to have the alias-key password setup to be the same as your keystore password (It keeps things simple).
    See the example below.

  6. Open your JDeveloper. Go to Tools > Preferences. Go to the ADF Mobile > Platforms configuration screen. Click on the Release Tab. Make the following configurations:
    Keystore Location: Specify your keystore file's location in Keystore
    Keystore Password: Specify your password
    Key Alias: Specify your key-alias
    Key Password: If you hit enter when prompted to enter a alias-key password and didnt enter any values, use the Keystore Password value. Otherwise, enter what you put for hte alias-key password.

  7. Go to your Mobile Application's Deployment Profile Properties window. Click on Android Options. Switch Build Mode from Debug to Release. Click OK to apply your changes.

  8. Deploy your app!

This concludes the end of another post. Keep ADF'ing!

Thursday, May 16, 2013

JDeveloper and Android SDK Incompatibility

While writing a quick test ADF Mobile app to verify a new training pc, I ran into an ADF Mobile deployment error below:

Cannot run program "... platform-tools\aapt"
CreateProcess error=2, The system cannot find the file specified.



This started happening because Android SDK Tools was updated from Rev. 21.1 to Rev 22. 


What revision 22 did was it moved aapt.exe to a different directory. The catch is that you can't configure or tell JDeveloper where to find this. 

To fix the issue, I took my SDK version back to Rev. 21.1, by extracting the Rev 21.1 zip and using that one. I did have to re-install/load the Android API, but 10 minutes and i was back in business. However, if you want use Rev 22, copy the contents of %SDK_Home%/build-tools/android-4.2.2 to %SDK_Home%/platform-tools. The only downside of this, is that Android SDK won't be able to maintain/update the platform-tools section. Which is why i'm using Rev 21.1 - theres nothing significant that you're missing by sticking with Rev. 21.1 vs Rev. 22.

Until Oracle changes how JDeveloper can find these libraries, you can use this workaround!

Update (05/21/2013): Per Chris Muir, ADF Product Manager, this issue has been officially logged at Oracle as a bug 168376554. They're working on it!
Source: https://blogs.oracle.com/onesizedoesntfitall/entry/adf_mobile_deploying_to_android





Silly JDeveloper - Android SDK Location Change

I was briefly tricked by this for a few minutes. And there's bound to be at least one other person out there whom will get tricked as well. This is for you :)

It appears Android made a slight change in their file structure. As a result, it sort of tricks JDeveloper and otherwise you as the developer, when its time to configure your Android SDK settings.

When selecting "Android SDK Location" under "Preferences > ADF Mobile > Platforms > Android", you are asked to select "%Root_Drive%/Android/android-sdk" for the location, like for example "D:\Android\android-sdk".

For some of you, selecting the suggested path by JDeveloper, you'll be greeted with an error message "Unable to locate Android SDK in the specified location %some_path%. Do you want to use the specified Android SDK location anyway?"




This is because, I had to select the "Android/android-sdk/sdk" directory, instead of "Android/android-sdk", as shown below.



Selecting the proper SDK location, lets you continue error free :)

Have fun ADF Developers!

Thursday, May 9, 2013

JDeveloper 11.1.2.4 Installation - Read This Before You Try!


If you're not familiar with JDeveloper 11.1.2.4 (11gR2) but familiar with earlier 11g releases, you may ask "since when was JDeveloper installations painful?". If you're not familiar, with JDeveloper at all, you should know that normally JDeveloper installations are almost always relatively painless and quick installation process (5-10 minutes max). Well this time around, it's fair to say Oracle botched the JDeveloper installation setup process. So unless you know all the little quirks to the installation, below is a guide on making your JDeveloper installation a breeze.


  1. Download and Install JDK 1.6.0_39+ or higher. I installed JDK 1.6.0_43.

    Java Download Location: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html

    Note: Even if you download the JDEveloper installation kit with a bundled JDK, the bundled JDK will not work. This is because Oracle bundled in an unsupported JDK version. Installing the wrong JDK will result in an error message when trying to start up JDeveloper: "Java version 1.6.0_24 not supported. The minimum version required is 1.6.0_35"

  2. Download the JDeveloper 11.1.2.4 release that applies to your system. If you do not know which type to get, the "Generic" installer will always work.

    Download location: http://www.oracle.com/technetwork/developer-tools/jdev/downloads/index.html

    Note: Mac OS X users must download the "Generic" Installer.

  3. Start up the JDeveloper 11.1.2.4 Installer

    For those whom downloaded the Windows JDeveloper Installation kit, simply double click on the "jdevstudio11124install.exe" installer.

    For "generic" jar folks: either double click on the jar, or run the command "%JAVA_JDK_HOME%/bin/java -jar name_of_jar_file.jar" in your command-line utility.

    Note: %JAVA_JDK_HOME% should be replaced with actual file system installation path of your JDK 6. and

  4. Choose your Middleware Home Directory. Make sure the directory you chose is clean/empty. For instance, I have multiple JDevelopers installed. Thus i have a separate middleware home for each JDeveloper install - to keep each environment clean.

  5. At the "Choose Install Type" screen, select "Custom".

  6. At the "Products and Components" screen, leave all options checked unless you have a preference otherwise.

  7. The following steps are very important, please follow carefully!
  8. At the "JDK Selection" screen, uncheck the SUN JDK 1.6.0_24. (Its not supported to run JDeveloper 11.1.2.4!)
  9. In the "JDK Selection" screen, click "Browse" to locate the JAVA_HOME of your JDK 1.6.0_39+. Click "Select" on the JDK Home.


  10. After selecting your JDK Home, your JDK should show up under "Local JDK", as shown below. You can now proceed to the next screen!

  11. Confirm your "Product Installation Directories". and click through the rest of the installer and you have a vanilla installation!

Important For ADF Mobile Developers:
  1. Use the JDeveloper "Help > Check for Updates" utility to download the ADF Mobile Bundle - its quick and easy to do.
  2. If you are developer native OS apps for Android devices, you need to go into your Android SDK Manager, and download the "Google Cloud Messaging for Android Library", as shown below.


    If you do not download this SDK component, you'll be greeted with deployment errors in JDeveloper:
    Failed to locate the Google Cloud Messaging for Android Library file named "gcm.jar". (oracle.adfmf.framework.dt.deploy.android.deployers.ValidatePreferencesDeployer)

That completes our segment for installing JDeveloper 11.1.2.4! 

Good luck!