Configure Android SDK with JDeveloper 11.1.2.4.0 for ADF Mobile Application Development

I spent several hours trying to figure out how to deploy an ADF Mobile application to my running desktop Android SDK emulator. I thought it would be worthwhile documenting the process as there are a few tweaks required and I could not find a straight forward guide online. This blog post guides you through the configurations required and assumes that you have a deploy-able ADF Mobile application.

I can provide you with a simple ADF Mobile application if you require it - leave me a comment with your email address.

Installations:
  1. Download Oracle JDeveloper 11.1.2.4.0 (Link)
  2. Download the Android SDK (Link)

AndroidSDK extraction:
  1. Extract the AndroidSDK download to C:/AndroidSDK
  2. Open SDK Manager found in C:/AndroidSDK
  3. Tick Google Cloud Messaging for Android Library, located under the Extras folder (Resolves this bug)

  4. Click Install Package(s), Accept License then click Install


Deployment bug resolution: (Source 1 Source 2)
There is a known bug at the deployment stage that requires the following actions to be performed to resolve:
  1. From C:/AndroidSDK/sdk/build-tools/android-4.2.2, copy the following files and directories:

    - Aapt.exe
     - Dx.bat
    - /libs

  2. Copy the above to C:/AndroidSDK/sdk/platform-tool


Setting up the AndroidSDK emulator with an AVD configuration: (Source)
  1.  Open a Command Prompt and change directory to C:/AndroidSDK/sdk/tools
  2. Enter the following command:
    android list targets

  3.  Record the ID of the Android Platform that you would like to utilise. (Typically, we will only have one and its ID will be 1)
  4.  Enter the following command to create the AVD configuration file: 
    android create avd –n <name> -t <targetID>

    Replace <name> with the name you want for the AVD and <targetID> with the ID recorded from earlier.

    The AVD configuration files will be written to C:/Users/<username>/.android/avd by default.

    To customise the AVD configuration file path, use the following command to create the AVD:

    android create avd –n <name> -t <targetID> -p C:/Path/To/AVD

    5.   The following prompt will appear:
    Do you wish to create a custom hardware profile [no]

    We want to select default, so press Enter.

Running the Android Emulator using an AVD configuration file
  1. Navigate to C:/AndroidSDK/sdk/tools
  2. Use the following command to run an instance of the emulator

    emulator –avd <avd_name>

    Replace <avd_name> with one of the AVD’s you created earlier.
  3. This will boot up the Android Emulator in a new window as shown below:
     Note: Closing the command prompt window that is used to run the emulator will also automatically close the emulator. (I learnt this the hard way!)



Configuring the AndroidSDK within JDeveloper
  1. Open JDeveloper 11.1.2.4.0
  2. Click Tools, then Preferences
  3.  Click ADF Mobile, then Platforms
  4. Select Android under Supported Platforms
  5. Configure the Android SDK Location and Android Platform Location to point to your extracted AndroidSDK location, as shown below:

                    6.  Click OK to finish the configuration.



Create a local key store to use Release Mode (Improved performance)
  1. Open command prompt and change directory to the JDK/bin used by your JDeveloper 11.1.2.4.0

    My path is:
    C:\Middleware2\11_1_2_4_0\jdk160_24\bin
  2. Type the following command into the command prompt (Note: you must type it, not copy):

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

    Replace <Keystore Name> and <Alias Name> with a custom name. I used ‘employees’ for both variables for my setup.

  3. You will be prompted for several values such as a keystore password, your name, city, state etc.
    Enter
    oracle for the keystore password, and enter values for the other prompts. They do not have to be ‘correct’ values.
    Another final password prompt is asked for your <keystore_name> password, enter
    oracle again.
  4. The keystore is ready to use, we now need to configure the connection inside JDeveloper.
  5. Open JDeveloper 11.1.2.4.0. Click Tools, Preferences, ADF Mobile, Platforms and then click on the Release Tab under Signing Credentials.
  6. Enter the required details as shown below. 

Keystore Location: Located under JDK/bin/<Keystore_Name_Chosen>
Keystore Password: oracle
Key Alias: <Alias_Name_Chosen>
Key Password: oracle


         7.   JDeveloper now knows about the keystore, which enables you to select the Release mode in the       deployment profiles


Deploy ADF Mobile App to the Android Emulator 
  1. In JDeveloper, from the Application menu, Select Deploy > New Deployment Profile.
  2. Click Android Options, select Release for the Build Mode, and click OK.
  3. From the Application menu, select Deploy > Above_Deployment_Profile_Name.
  4. Select Deploy application to emulator, click Next, then click Finish.
  5. Wait for Deployment to finish, then switch to the Android Emulator you have running and select your deployment application from the Androids’ apps.

9 comments:

  1. Hi Onkar,

    I am not able to install the SDK Manager for windows7. i am not getting any errors also

    Regards
    Sunil Kumar B

    ReplyDelete
    Replies
    1. Hi Sunil,

      Have you tried setting this up in another Operating System? This will determine if the issue is with Windows 7, or you are having a general issue setting this up.

      Regards
      Onkar

      Delete
  2. Hi Onkar,
    i have set the path in the preference, ......\sdk\platforms\android-18
    and i have published my application also.
    but my application is crashing after splash screen in Samsung Galaxy Tab3 10".
    can u please guid me
    Thanks
    Rajeev Rajan

    ReplyDelete
    Replies
    1. Hi Rajeev,

      Have you tried running the application in another device or emulators? Is the issue only occurring in that specific Tab?

      Regards
      Onkar

      Delete
  3. hi, i downloaded Oracle JDeveloper 11.1.2.4.0 bt when going to create new project there is no option for mobile applicaiton(ADF) in new Gallery pls help me in this

    ReplyDelete
    Replies
    1. Hi Raj,

      In the JDeveloper Toolbar, click Help -> Check for Updates.

      Ensure the extension for ADF Mobile has been installed. It will restarted JDeveloper once installed and option to create the project will appear.

      Hope that helps,
      Onkar

      Delete
  4. Hi

    I am getting error in android SDK location setup.it says invalid path .

    Error is opening of wallet based credential store failed .reason is java.IoException .Due to this am unable to see any virtual device in deploy option.Could you pls help on this.Adnroid studio has been installed and MAF has been installed through Update,SDK,virtual device everything is fine .

    Thanks in advance

    ReplyDelete