This chapter includes the following sections:
Prepare the environment for application development by setting up Eclipse, platform-specific tools, and a mobile device.
Before developing a MAF application, you must set up your development environment by downloading, installing, and configuring various software components.
To set up a typical MAF development environment that consists of an IDE, mobile platform-specific tools, and, possibly, a mobile device, follow the steps described in Prerequisites for Developing MAF Applications.
For a complete list of supported versions of development and runtime tools, see Oracle Mobile Application Framework Certification Matrix by following the Certification Information link on the MAF documentation page at http://www.oracle.com/technetwork/developer-tools/maf/documentation/
.
To develop MAF applications for this version of MAF, you need to use the JDK8 JRE.
You need to specify JDK 8's JRE as the default JRE for OEPE, as described in How to Specify JDK 8's JRE as the Default in OEPE.
See the following sections for platform-specific prerequisites if you plan to target one or both of the following platforms:
What You Need to Develop an Application for the iOS Platform
What You Need to Develop an Application for the Android Platform
What You Need to Develop an Application for the Universal Windows Platform
You do not need to install any additional tools for creating specific types of MAF application content (HTML, remote URL, or MAF AMX).
A Mac computer, OEPE, Xcode and iOS SDK, JDK 1.8, credentials, and an iOS-powered device are needed for to develop applications for the iOS platform.
Before you start creating a MAF application for iOS, ensure that you have the following available:
A computer running Mac OS X
OEPE (see Setting Up OEPE)
Xcode and iOS SDK (see How to Install Xcode and iOS SDK)
The most recent version of JDK 8
Before you start deploying your application to a development environment (see Getting Started with Mobile Application Development in Developing Mobile Applications with Oracle Mobile Application Framework (OEPE Edition)), decide whether you would like to use a mobile device or its simulator: if you are to use a simulator, see How to Set Up an iPhone or iPad Simulator; if your goal is to deploy to a mobile device, ensure that, in addition to the components included in the preceding list, you have the following available:
Various login credentials. See Deploying Mobile Applications in Developing Mobile Applications with Oracle Mobile Application Framework (OEPE Edition).
iOS-powered device. See How to Set Up an iPhone or iPad.
Besides a computer running an OS supported by MAF, you need OEPE, JDK 8, Android SDK with platform and build tools, credentials, and an Android-powered device to develop applications for the Android platform.
Before you start creating a MAF application for Android, ensure that you have the following available:
A computer running an operating system listed in the Desktop OS Requirements section of the Oracle Mobile Application Framework Certification Matrix that you access by following the Certification Information link on the MAF documentation page at http://www.oracle.com/technetwork/developer-tools/maf/documentation/
.
The most recent version of JDK 8
Android SDK with platform and build tools (see Setting Up Development Tools for the Android Platform)
OEPE (see Installing Oracle Enterprise Pack for Eclipse.)
A computer with x86 architecture running the Windows 10 operating system, JDK 8, Microsoft Visual Studio 2015, MSBuild 14.0, and OEPE are required to develop applications for Universal Windows Platform.
Before you start creating a MAF application for Universal Windows Platform, ensure that you have the following available:
A computer with x86 architecture running the Windows 10 operating system
The most recent version of JDK 8
Microsoft Visual Studio 2015 (Enterprise, Professional, or Community edition)
MSBuild 14.0 (automatically installed with Visual Studio 2015)
Visual Studio Tools for Universal Windows Apps (an optional component when installing Visual Studio 2015)
Visual Studio 2015 is available at: https://www.visualstudio.com/products/vs-2015-product-editions
OEPE (see Installing Oracle Enterprise Pack for Eclipse.)
For more information about setting up and configuring your development environment, see Setting Up Development Tools for the Universal Windows Platform.
Learn how to specify the JRE and configure OEPE to target the Mobile application platform.
Setting up OEPE to develop MAF applications requires you to:
Specify the JRE from JDK 8, as described in How to Specify JDK 8's JRE as the Default in OEPE.
Configure OEPE to target the platform(s) you want the MAF application to run on, as described in How to Configure the Development Environment for Target Platforms.
OEPE requires that JDK 8 be specified as the default JRE for application development. Use the procedure to specify the JRE of JDK 8 as the default in OEPE.
You must specify the JRE packaged with JDK 8 as the default JRE in OEPE so that OEPE adds this JRE to the build path of newly-created MAF applications.
To specify JRE of JDK 8 as the default in OEPE:
Before you start developing and deploying a MAF application, you may need to configure preferences for appropriate platforms.
OEPE must be provided with information to package and deploy an application to a target platform. Use the procedure to configure the environment for target platforms.
For successful packaging and deployment of your application to target platforms supported by MAF, OEPE must be provided with information such as the name of the platform and directories on your development computer that contain the platform-specific tools and data.
Before you begin:
Depending on your target platform, download and configure the appropriate software for your target platform:
Android SDK (see Setting Up Development Tools for the Android Platform) or iOS SDK and Xcode (see How to Install Xcode and iOS SDK)
Visual Studio (see How to Install Visual Studio)
To configure your environment for target platforms:
Set up an iPhone, iPad, or simulators to which MAF applications can be deployed.
In addition to general-purpose tools listed in Prerequisites for Developing MAF Applications, you might want to set up an iPhone or iPad when getting ready for 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, you do not need to separately install them. See How to Set Up an iPhone or iPad Simulator.
Download Xcode, which includes the iOS SDK, and run it at least once to ensure that builds and deployments proceed smoothly.
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 performed, any build and deploy cycle from OEPE to Xcode or a device simulator fails with a "Return code 69" error.
Note:
Since older versions of Xcode 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 gain access to the Apple developer site at http://developer.apple.com
.
An iOS-powered device with a valid license, certificates, and distribution profile must be connected to your computer for deployment of 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 are planning to use an actual iPhone or iPad, which is preferable for testing (see Testing MAF Applications in Developing Mobile Applications with Oracle Mobile Application Framework (OEPE Edition)), you need to connect it 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 (OEPE Edition).
Note:
Since Apple licensing terms and conditions may change, ensure that you understand them, comply with them, and stay up to date with any changes.
Configure the external network access to use iOS simulators included in XCode downloads for the deployment of 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.
Note:
Before attempting to deploy your application from OEPE to a device simulator, you must first run the simulator.
If you are planning to use web services in your application and you are behind a corporate firewall, you might need to configure the 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 (OEPE Edition).
Install the Android SDK to deploy a MAF application to Android devices.
The Android SDK provides the tools that build and package your application into an .APK file (the file type that installs applications on Android devices), an emulator to create Android Virtual Devices (AVD) where you can test your application if you do not have access to a physical Android device, and an OEM USB driver to connect your development machine to a physical Android device through a USB cable if you do have a device. This last option enables you to deploy an application from your development machine to the Android device.
Android Studio, Google’s IDE for Android development, includes the Android SDK in its installation and provides wizard options that simplify the management of the SDK platforms and tools that you need.
Install Android Studio, and the Android SDK that it includes, by downloading the installation file from https://developer.android.com/studio/index.html. The Android Developer’s website provides installation instructions for Windows, Mac, and Linux. See https://developer.android.com/studio/install.html.
Once you have installed Android Studio, perform the tasks described in the following topics:
Tip:
Android Studio prompts you with wizards to create AVDs, install emulator accelerators, or install the OEM USB driver required to connect to a real device when you attempt to run an app that you create in Android Studio. Consider completing the tasks described in Building Your First App to create a native Android app up to the point where it describes how to run the app on a real device or an emulator. Upon completion of this task, you will have an environment (an AVD on the emulator or a real device) where you can deploy an Android native app. A MAF application is packaged in the same type of installation file (.APK) as the Android native app, so once you have successfully completed this task, you know that you have an environment ready to install a MAF application.You can accelerate the performance of the emulator that renders AVDs by installing an emulator accelerator.
Once installed, the emulator accelerator speeds up the performance of the emulator and the AVDs that it emulates by allocating additional resources from your development machine. You specify the amount during installation of the accelerator. Once installed, the accelerator appears in the SDK Tools list of the SDK Manager that you can launch from Android Studio, as shown in the following image. The Intel x86 Emulator Accelerator (HAXM) is one type of emulator accelerator that is available.
Figure 2-2 Install Emulator Accelerator
Make sure that the update site for the emulator accelerator that you want to download is selected in the SDK Update Sites tab shown in the previous image. Once downloaded, execute the installer. See https://developer.android.com/studio/run/emulator-acceleration.html#accel-vm.
An Android Virtual Device (AVD) replicates an Android device on your development computer. It is a useful option for testing, especially if you only have access to one or a limited range of physical Android devices.
The AVD Manager that you launch from Android Studio by clicking Tools, Android, and AVD Manager has a range of ready-to-use virtual devices, mostly of those devices developed by Google itself, such as the Nexus and Pixel XL range. Other Android device vendors, such as Samsung, provide specifications on their websites that you can use to create the AVD yourself.
Google maintains documentation describing how to manage AVDs. See https://developer.android.com/studio/run/managing-avds.html.
To create an AVD:
In Android Studio, launch the Android Virtual Device Manager by selecting Tools > Android > AVD Manager.
In the Your Virtual Devices screen, click Create Virtual Device.
In the Select Hardware screen, select a phone device, such as Pixel, and then click Next.
In the System Image screen, click Download for one of the recommended system images. Agree to the terms to complete the download.
After the download completes, select the system image from the list and click Next.
On the next screen, leave all the configuration settings unchanged and click Finish.
In the Your Virtual Devices screen, select the device you just created and click Launch this AVD in the emulator.
You can install your app directly from your development machine to your Android device by configuring the Android device and connecting it to your development machine using a USB cable.
To set up your Android device:
Connect your device to your development machine with a USB cable. If you are developing on Windows, you might need to install the appropriate USB driver for your device. For help installing drivers, see the OEM USB Drivers document.
Enable USB debugging on your device by going to Settings > Developer options.
Note:
Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.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 the 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 What You Need to Develop an Application for the Universal Windows Platform.
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.
Create and install the PFX file as described in How to Create a PFX File for MAF Applications and How to Install a PFX File on Windows 10.
Enable Development Mode on the computer on which you intend to develop the application as described in How to Enable Developer Mode on Windows 10.
After completing these setup tasks, a MAF application can be deployed to the UWP. See Deploying a MAF Application to the Universal Windows Platform in Developing Mobile Applications with Oracle Mobile Application Framework (OEPE Edition).
Install Visual Studio 2015 to access the Microsoft tools that are needed to build applications for deployment to Universal Windows Platform. Use the procedure to install Visual Studio.
You download and install Visual Studio from Microsoft Visual Studio web page, see https://www.visualstudio.com/products/vs-2015-product-editions
. The Visual Studio download includes the Windows 10 SDK.
To install Visual Studio
For the following information, see Windows Software Development Kit (SDK) for Windows 10 at https://dev.windows.com/en-us/downloads/windows-10-sdk
.
What's in the kit
New APIs
New and updated tools
System requirements
Instructions to install and uninstall
Known issues
A Personal Information Exchange file is needed to sign Universal Windows Platform based MAF applications. Use the procedure to create a PFX file.
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
).
To create a PFX file:
Every Personal Information Exchange file on a computer must be manually installed in a certificate store if you want to use it for application signing. Use the procedure to install a PFX file in a certificate store.
Copy or install.
An operating system keeps certificates in an area called a certificate store. A Software Publisher Certificate (SPC), with its private and public keys, is used for application signing. SPC is stored in a Personal Information Exchange (.pfx) file. A PFX file has to be copied or installed to a certificate store.
Note:
The installation has to be completed once, manually, for every PFX file on a given computer.
To install a PFX file in a certificate store:
Enable Developer Mode on the Windows 10 computer so that you can side-load applications. Use the procedure to enable Developer Mode.
Enable Developer Mode to develop MAF applications on Windows 10.
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 debug mode.
To enable Developer Mode:
Select a sample application from the Samples folder of the MAF extension download, and deploy it either to an iOS-powered device simulator or an Android-powered device emulator to test the environment setup. Use the procedure to test the setup.
You can test your environment setup as follows:
See Deploying MAF Applications in Developing Mobile Applications with Oracle Mobile Application Framework (OEPE Edition).
After a successful deployment (which might take a few minutes), your iOS-powered device simulator or Android-powered device emulator will display the HelloWorld application icon that you have to activate to launch the application.