This chapter includes the following sections:
The development environment for MAF applications requires that you install JDeveloper and the MAF extension, configure form factors, and install and configure third-party tools to package and deploy the applications to supported platforms.
After you install JDeveloper and the MAF extension, as described in Installing Mobile Application Framework with JDeveloper , configure the development environment for the platforms to which you want your MAF application deployed. Configure form factors if you want to test or deploy applications on a particular mobile device. Install and configure third-party tools if you want to package and deploy your MAF application on supported platforms.
For the complete list of supported versions of development and runtime tools, see Certification Information in Oracle Mobile Application Framework Documentation on Oracle Technology Network at: http://www.oracle.com/technetwork/developer-tools/maf/documentation/index.html.
Configure the platform-specific settings to package and deploy applications to the Android, iOS, or Windows platforms.
Download and install JDeveloper and the MAF extension. See Installing Mobile Application Framework with JDeveloper .
For the Android platform, download and configure the Android SDK. (See How to Install the Android SDK.)
For the iOS platform, download and configure the iOS SDK and Xcode. (See How to Install Xcode and iOS SDK.)
For the Universal Windows Platform (UWP), download and configure the Windows SDK by installing Microsoft Visual Studio 2015. See Setting Up Development Tools for the Universal Windows Platform.
To configure your environment for target platforms:
For the Android platform, specify the following:
The Android SDK location on your computer
The Android build tools location on your computer
Information on the signing credentials
Figure 2-1 Configuring Platform Preferences for Android
For the iOS platform, specify the following:
Location of the iTunes media files, including the mobile applications that are synchronized to the iOS-powered device
The iOS-powered device signing information (See Setting the Device Signing Options in Developing Mobile Applications with Oracle Mobile Application Framework.)
Note:The Hash Algorithm is currently not used.
A form factor is a specific device configuration. Each form factor is identified by a name that you specify for it, and contains information on the specified resolution denoted by pixel width and pixel height.
Since form factors that are defined in preferences are used in the MAF AMX page Preview tab (see Using the Preview in Developing Mobile Applications with Oracle Mobile Application Framework), you may choose to perform this configuration if you are planning to include a MAF AMX application feature as part of your MAF application and you do not want to accept the default settings. During development, you can select or switch between various form factors to see how a MAF AMX page is rendered. You can also see multiple form factors applied to the same page using the split screen view.
See About the maf-config.xml File in Developing Mobile Applications with Oracle Mobile Application Framework.
Before you begin:
Download and install JDeveloper and the MAF extension, as described in Installing Mobile Application Framework with JDeveloper .
To configure the form factors:
Figure 2-2 Defining Form Factors
The Mobile Application Framework page is populated with available form factors and the default is set to Android Low.
This preference page allows you to create and manage a set of named form factors that combine a screen resolution size and platform.
Name: a meaningful string that is used to identify the form factor.
Platform: the platform of the mobile device.
Model: the type of the mobile device.
Default Orientation: the default device orientation used in the MAF AMX page Preview tab. It might be Portrait or Landscape. Select this setting from the drop-down list of values. The default value is Portrait and it is pre-populated during the creation of the new form factor.
Width: width, in pixels. This value must be a positive integer, and its input is validated.
Height: height, in pixels. This value must be a positive integer, and its input is validated.
Scale Factor: the display scale factor. This value must be either one of 1.0, 2.0, or 3.0.
If you fail to set the name and resolution for your form, MAF displays an error message.
Set up the iOS devices or install XCode containing iOS SDK with simulators to equip the environment for the deployment of applications to the iOS platform.
In addition to the general-purpose tools listed in Introduction to Installing the MAF Extension with JDeveloper, you might want to set up an iPhone or iPad when getting ready for the development of a MAF application for the iOS platform (see How to Set Up an iPhone or iPad).
Since iPhone and iPad simulators are included in the iOS SDK installation, which, in turn, is included in the Xcode installation, you need not install them separately. See How to Set Up an iPhone or iPad Simulator.
Follow the instructions to download Xcode, which includes the iOS SDK.
You download Xcode from
http://developer.apple.com/xcode/. This download includes the iOS SDK.
After installing Xcode, you have to run it at least once and complete the Apple licensing and setup dialogs. If these steps are not followed, the build and deploy cycle from JDeveloper to Xcode or a device simulator fails with a "Return code 69" error.
Since older versions of Xcode and iOS SDK are not available from the Mac App Store, in order to download them you must obtain an Apple ID from
http://appleid.apple.com, and then register this Apple ID with the Apple Developer Program to access the Apple developer site at
Connect an iOS-powered device, with a valid license, certificates, and distribution profile, to your computer to deploy an application to the device.
In your MAF application development and deployment, you can use either the iPhone, iPad, or their simulators (see How to Set Up an iPhone or iPad Simulator). If you plan to use an iPhone or iPad, which is preferable for testing (see Testing MAF Applications in Developing Mobile Applications with Oracle Mobile Application Framework), connect the device to your computer to establish a link between the two devices.
To deploy to an iOS-powered device, you need to have an iOS-powered device with a valid license, certificates, and distribution profiles. See Deploying Mobile Applications in Developing Mobile Applications with Oracle Mobile Application Framework.
Since the Apple licensing terms and conditions may change, ensure that you understand them, comply with them, and stay up to date with any changes.
Configure external network access to use iOS simulators, included in XCode downloads, to deploy MAF applications.
In your MAF application development and deployment, you can use either the iOS-powered device itself (see How to Set Up an iPhone or iPad) or its simulator. Deploying to a simulator is usually much faster than deploying to a device, and it also means that you do not have to sign the application first.
A simulator can be invoked automatically, without any additional setup.
Before attempting to deploy your application from JDeveloper to a device simulator, you must first run the simulator.
If you plan to use web services in your application, and you are behind a corporate firewall, you may need to configure external network access. You do so by modifying the network settings in the System Preferences on your development computer. See Configuring the Browser Proxy Information in Developing Mobile Applications with Oracle Mobile Application Framework.
Once you install the Android SDK, use its SDK manager to install platform tools, a version of the Android platform, such as API 23, and the Android Support Repository.
In addition to the general-purpose tools listed in Introduction to Installing the MAF Extension with JDeveloper, you may want to set up an Android-powered device when getting ready for the development of a MAF application for the Android platform. See How to Set Up an Android-Powered Device.
Since emulators are included in the Android SDK installation, you do not need to separately install them. However, you cannot use an emulator until you configure it. See How to Set Up an Android Emulator.
To develop applications for the Android platform, you can use any operating system that is supported by both JDeveloper and Android.
See the Developer Tools section of the Android Developers website at
Android SDK includes development tools that you need to build applications for Android-powered devices. Since the Android SDK is modular, it allows you to download components separately depending on your target Android platform and your application requirements.
Before you begin:
Ensure that your environment meets the operating system, JDK version, and hardware requirements listed in the Get the Android SDK section of the Android Developers website at
To install the Android SDK:
Figure 2-3 SDK Manager with SDK Platform for API 23 and the Android Support Repository Installed
Follow the instructions on setting up devices on the Android Developers website , and then, following the steps in the task, edit the
android_winusb.inf file with the values for your device to deploy a MAF application to an Android-powered device.
In your MAF application development and deployment, you can use either the Android device itself, which is preferable for testing (see Testing MAF Applications in Developing Mobile Applications with Oracle Mobile Application Framework), or an emulator (see How to Set Up an Android Emulator).
For information on how to set up the Android-powered device, follow the instructions from the Using Hardware Devices section of the Android Developers website at
You might experience issues when using USB connectivity for the device-based debugging. See Testing and Debugging MAF Applications in Developing Mobile Applications with Oracle Mobile Application Framework.
Your target Android-powered device might not be listed in the
.inf file of the USB device driver, resulting in the failure to install the Android Debug Bridge (ADB). You can eliminate this issue as follows:
[Google.NTamd64]sections of the
See Install the Google USB Driver at
Follow the instructions on the Android Developers website to create the Android Virtual Device and review the configuration of the settings.
In your MAF application development and deployment, you can use either the Android device itself (see How to Set Up an Android-Powered Device) or its emulator. Deploying to an emulator is usually much faster than deploying to a device, and it also means that you do not have to sign the application first.
For information on how to create an emulator configuration called Android Virtual Device (AVD), follow the instructions from the Managing Virtual Devices section of the Android Developers website at
http://developer.android.com/tools/devices/index.html. When creating an AVD through the Create New Android Virtual Device dialog (see Managing AVDs with AVD Manager at
http://developer.android.com/tools/devices/managing-avds.html), review all the settings to ensure that configuration matches what you are planning to emulate. In particular, you should verify the following:
The Target field should define the desired Android platform level for proper emulation.
The CPU/ABI field should reflect the ARM or Intel Atom system image (see Configuring AVD for Intel HAXM).
The SD card field should be defined based on whether the application uploads files or files install themselves to the SD card.
The default settings for the Hardware field (see the Hardware Options table at
http://developer.android.com/tools/devices/managing-avds.html#hardwareopts) must be acceptable for a typical MAF application. For the additional hardware capabilities you may want to use in your application, such as cameras or geolocation services, create new properties.
You need to create an AVD for each Android platform on which you are planning to test your application.
For information on how to use the emulator, see the Using the Android Emulator section in the Android Developers website at
After the basic Android emulator setup is complete, you may choose to perform the following configurations:
You can reduce the emulator's load time by saving the emulator state or reusing the saved state. To do so, you manipulate the
avd files or folders that are located in the
\.android\avd directory (on a Windows computer). Each
avd folder contains several files, such as
cache.img. You can copy the
cache.img file to another emulator's
avd folder to use that state with another emulator.
Alternatively, you can use the command line to run relevant commands, such as, for example,
-no-snapstorage, and so on. You can access these commands through
emulator -help command.
When using this utility, keep in mind that in the process of loading, all contents of the system, including the user data and SD card images, will be overwritten with the contents they held when the snapshot was made. Unless saved in a different snapshot, any changes will be lost.
The "SD Card Emulation" section of the Android Developers website at
http://developer.android.com/tools/devices/emulator.html#sdcard lists reasons for creating, saving, and reusing the SD card. You can perform these operations by executing the following commands:
To create an SD card:
C:\android sdk directory\tools>mksdcard -l SD500M 500M C:\Android\sd500m.img
To list existing AVDs:
C:\android sdk directory\tools>android list avd
This produces a listing similar to the following:
Name: AndroidEmulator1 Device: Nexus S (Google) Path: C:\Users\username\.android\avd\AndroidEmulator1.avd Target: Android 4.2.2 (API level 17) Tag/ABI: default/x86 Skin: 480x800 ------------ Name: AndroidEmulator2 Device: Nexus S (Google) Path: C:\Users\username\.android\avd\AndroidEmulator2.avd Target: Android 4.2.2 (API level 17) Tag/ABI: default/armeabi-v7a Skin: 480x800 Sdcard: 500M
To start the AndroidEmulator2 with the SD card that has just been created:
C:\Android\android sdk directory\tools>emulator -avd AndroidEmulator2 -sdcard C:\Android\sd500m.img
To list the running Android emulator instances:
C:\Android\android sdk directory\platform-tools>adb devices
To copy a test image to the SD card (this requires the emulator to restart):
C:\Android\sdk\platform-tools>adb push test.png sdcard/Pictures 85 KB/s (1494 bytes in 0.017s)
For more information, see the Android Tools Help at
From the Android emulator, you can access your host computer through the 10.0.2.2 IP. To connect to the emulator from the host computer, you have to execute the
adb command from a command line on your development computer or from a script to set up the port forwarding.
To forward socket connections, execute
using the following forward specifications:
unix domain socket name
unix domain socket name
unix domain socket name
character device name
process pid (remote only)
For example, an arbitrary client can request connection to a server running on the emulator at port 55000 as follows:
adb -e forward tcp:8555 tcp:55000
In this example, from the host computer, the client would connect to
localhost:8555 and communicate through that socket.
For more information, see the "Android Debug Bridge" section in the Android Developers website at
If your development computer is behind a corporate firewall, you might need to configure a proxy by using one of the following techniques:
Execute this command to start the emulator and initiate its connection with the browser:
emulator -avd myavd -http-proxy myproxy
Start the emulator and then use its Settings utility as follows:
Click Settings, and More.
Click Cellular networks, and then Access Point Names.
Select an access point and set the proxy, port, username, and password.
Note:Turn Airplane mode off and on to ensure that the changes are applied.
Use the Android SDK Manager or an Intel location to download Intel HAXM that uses Intel drivers to accelerate the functioning of an Android-powered device emulator.
The Intel Hardware Accelerated Execution Manager (Intel HAXM) is designed to accelerate the Android-powered device emulator by making use of Intel drivers.
The Intel HAXM is available for computers running Microsoft Windows, Mac OS X, and a separate kernel-based virtual machine option (KRM) for Linux. See
http://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager to access installation guides and detailed descriptions of system requirements for each operating system.
Regardless of which operating system your development computer is running on, it must have the following:
The Android SDK installed (see How to Install the Android SDK).
Intel processor with support for Intel VT-x, EM64T and Execute Disable (XD) Bit functionality at the BIOS level.
At least 1 GB of available RAM.
To download the Intel HAXM, either use the Android SDK Manager (see Speeding Up the Android Emulator on Intel Architecture) or use the following Intel locations:
To install the Intel HAXM, follow the steps described in the Speeding Up the Android Emulator on Intel Architecture available at
http://software.intel.com/en-us/android/articles/speeding-up-the-android-emulator-on-intel-architecture. It is particularly important to configure AVD (see Configuring AVD for Intel HAXM).
If your development computer is running either Microsoft Windows 8.n or later, or Mac OS X 10.9.n or later, you have to apply a Hotfix provided by Intel before using the emulator with the Intel HAXM.
If you do not apply the Hotfix, your computer will freeze and you will lose your work.
To download the Hotfix, use the following locations:
When enabling the Intel HAXM, ensure that you download the Intel system image for the Android API level using the Android SDK Manager (see Figure 2-4). The following steps described in Speeding Up the Android Emulator on Intel Architecture guide you through the configuration process:
After you have installed the Android SDK, open the SDK Manager and then find the Intel HAXM in the extras section.
Select Intel x86 Emulator Accelerator (HAXM) and click Install packages.
Once you have installed the package, the status changes to Installed, which is not accurate: the SDK only copies the Intel HAXM executable on your computer; you have to manually install the executable.
Figure 2-4 Downloading Intel System Image in Android SDK Manager
To install the Intel HAXM executable, depending on your development platform search your hard drive for one of the following:
On Windows, search for
On Mac OS X, search for
If you accepted default settings, the executable should be located at
C:\Program Files\Android\android-sdk\extras\Intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe on Windows.
The Intel HAXM only functions in combination with one of the Intel Atom processor x86 system images, which are available for Android 2.3.3 (API 10), 4.0.3 (API 15), 4.1.2 (API 16), 4.2.2 (API 17), 4.4 (API 19), 4.4W (API 20), 5.0 (API 21). These system images can be installed exactly like the ARM-based images through the Android SDK Manager.
Figure 2-5 Installing Intel Atom System Image
To complete the process, use the AVD Manager to create a new virtual device that has hardware-accelerated emulation by selecting Intel Atom (x86) as the CPU/ABI, (see Figure 2-6).
This option appears in the list only if you have the Intel x86 system image installed.
Figure 2-6 Creating Accelerated AVD
Ensure that the development computer meets the installation requirements, install the MAF extension and Visual Studio 2015, create and install the PFX file, and enable Development Mode on the computer to set up a Windows 10 computer for application development.
To set up your development machine so that you can develop and deploy a MAF application to UWP:
Verify that your computer meets the requirements listed in Installation Requirements for MAF Applications to be Deployed to the Universal Windows Platform.
Install the MAF extension following the steps in Installing the MAF Extension in JDeveloper.
Install Visual Studio from Microsoft. The Visual Studio download provides the Windows SDK that enables deployment of applications to the UWP. Select the Visual Studio edition that you require: Community, Professional, or Enterprise. All editions provide the required software to develop and deploy a MAF application to the UWP. Visit the Visual Studio Community product page for information about the eligibility criteria to use Visual Studio Community edition.
Enable Development Mode on the computer on which you intend to develop the application as described in Enabling Development Mode in a Windows 10 Device.
After completing these setup tasks, a MAF application can be deployed to UWP. See Deploying a MAF Application to the Universal Windows Platform in Developing Mobile Applications with Oracle Mobile Application Framework.
Install Visual Studio 2015, which includes the Windows 10 SDK.
Note:The Visual Studio 2015 package includes the Windows 10 SDK.
Figure 2-7 Installing Visual Studio
For the following information, see Windows Software Development Kit (SDK) for Windows 10 at
What's in the kit
New and updated tools
Instructions to install and uninstall
Follow the steps in the task to create a Personal Information Exchange (PFX) file that is needed to digitally sign Universal Windows Platform (UWP) based MAF applications.
MAF applications based on UWP must be digitally signed before deployment. A PFX file is required to sign an application. A PFX file contains a public x509 certificate file (.cer) and a private key file (.pvk file).
makecert.exe -sv c:\somedir\MyKey.pvk -n "CN=Your Name,OU=MAF,O=Oracle,C=US" -r -h 0 -eku "22.214.171.124.126.96.36.199.3,188.8.131.52.4.1.3184.108.40.206" c:\somedir\MyKey.cer
The "-eku" (Enhanced Key Usage) flag value must not have spaces between the two comma delimited values. The 220.127.116.11.18.104.22.168.3 OID indicates that the certificate is valid for code signing. The 22.214.171.124.4.1.3126.96.36.199 indicates that the certificate respects lifetime signing.
The "-r" flag creates a self-signed root certificate. This simplifies management of your test certificate.
The "-h 0" flag marks the basic constraint for the certificate as an end-entity. This constraint prevents the certificate from being used as a Certification Authority (CA) that can issue other certificates.
Verify whether a .pvk and .cer file were created at the specified locations.
pvk2pfx.exe -pvk c:\somedir\MyKey.pvk -spc c:\someDir\MyKey.cer -pfx c:\someDir\MyPFX.pfx -pi welcome -po welcome
-pi : Specify this flag or value if you entered a password for the pvk file that you created. If the pvk file is password protected, and you do not specify the flag, pvk2pfx.exe will prompt you for the password.
-po : Specify this flag or value if you want to password-protect the .pfx file being created.
Verify whether a PFX file was created.
Follow the steps in the task to install a Personal Information Exchange (PFX) file in a certificate store on a computer so that the certificate can be used for application signing.
Note:The installation has to be completed once, manually, for every PFX file on a given computer.
Note:The default file location is the location of the file that you double-clicked.
Follow the steps in the task to enable Developer Mode on the Windows 10 development computer to side-load applications and to run them in the Debug mode.
Windows 10 runs UWP applications from a trusted source. Since the certificates you imported are self-signed, they will not run by default.
If you want to develop and deploy MAF applications to the UWP you must enable Developer Mode on the Windows 10 computer that you use. Developer Mode is required for the following reasons:
Side-load, or install and run applications, from unofficial sources.
Run an application in the Debug mode.
Note:If you create an application in Visual Studio, the system prompts you with a dialog to enable Developer Mode.
Note:You can use the same PFX file to run your application in the Release and Debug modes on your computer. We recommend that you use a certificate issued by a trusted authority, such as your internal CA, if you want to distribute your application and run it on other devices within your organization.
Deploy a MAF sample application to test that you set up your environment successfully.
You can test your environment setup as follows:
See Deploying Mobile Applications in Developing Mobile Applications with Oracle Mobile Application Framework.
For iOS, select Deploy application to simulator, as Figure 2-8 shows.
Figure 2-8 Selecting Deployment Action for iOS
For Android, select Deploy application to emulator, as Figure 2-9 shows. Ensure that the emulator is running before you start the deployment.
Figure 2-9 Selecting Deployment Action for Android
For the Windows platform, use the following steps:
Click Application, Deploy, and then Windows1.
In Deployment Action, select the deployment action to deploy the mobile application to a local Windows machine.
See Deploying Mobile Applications in Developing Mobile Applications with Oracle Mobile Application Framework.
After a successful deployment (which might take a few minutes), the device to which you had deployed the application displays the launch screen of the HelloWorld application, and then displays the default application feature.
You can set MAF preferences required to develop MAF applications, such as the Android SDK location, by specifying startup parameters when you start JDeveloper. Startup parameters exist to specify the MAF preferences to develop and deploy MAF applications on the Android and iOS platforms.
To launch JDeveloper from the command line with startup parameters, use the
-J-D options. All strings must be enclosed in double-quotes, as shown in the examples.
The following example shows how to override the location of the Android SDK:
These are the startup parameters you can use to set Android preferences from the command line:
The following example shows how to override the location of the iTunes Media folder:
./jdev -J-Doracle.adfmf.framework.dt.preferences.PlatformSDKsPrefs.iOSiTunesDir="/Users/<my_username>/Music/iTunes/iTunes Media/Automatically Add to iTunes.localized"
These are the startup parameters you can use to set iOS preferences from the command line: