As most of you are aware, ADF Mobile can hook into JDeveloper's Remote
Debugging to support Java code debugging, such as setting breakpoints
and stepping through the code interactively from an emulator or an
actual device. The steps to enable debugging are described in the
latest ADF Mobile Developer Guide, and Shay also had a
nice entry on how to enable debugging on Android.
The developer guide also contains details on how to enable more refined
levels of logging, and view log output using either the Mac Console
application or the Android Monitor application. Let's explore how
all this works in a bit more detail.
Furthermore, log output to the Mac
console may not display certain logging messages - for example ones
coming from the embedded Java Virtual Machine. This is due to
some compatibility issues between Mac OS (Mountain Lion) and the log
output mechanism. In this article, we will also discuss how to
properly output all logging messages and perform more in-depth
debugging and analysis using device native tools, with the same
capability that native application developers enjoy when debugging an
application written in native code such as Objective C.
iOS Debugging Using Xcode Utilities
Unreliable logging from the Java Virtual Machine is a major issue with
debugging ADF Mobile application on iOS devices or simulator. The
underlying cause is incompatibility issues with Java Virtual Machine
running on the latest Mac OS (Mountain Lion). Furthermore, it is
difficult to debug on an actual device - necessary when debugging
issues with invoking device services such as camera or GPS.
However, you can use Xcode and a tethered iOS device to display all
logging messages from the device, ADF Mobile container, and the
embedded JVM, while running the ADF Mobile application. To do
this, you will need:
A Mac running Moutain Lion or Lion
Latest version of Xcode - as of May 2013, the latest version is
4.6.2. Latest version of Xcode is necessary to properly recognize
devices running latest version of iOS, as older versions of Xcode
cannot properly connect to the most recent version of the iOS.
One frequently asked question here is that ADF Mobile does not
always officially support the latest version. In general,
officially supported version has been thoroughly tested by Oracle QA,
and therefore is recommended for most development purposes.
However, the latest version of Xcode would typically be compatible -
please check JDeveloper
Forum for any reports of issues.
If indeed ADF Mobile for some reason can't use the latest
Xcode version to deploy an application, you can still follow the steps
below. When you open the temporary Xcode project generated by
JDeveloper, you would simply use the latest version of Xcode. The
rest of the instructions would still be valid.
Oracle JDeveloper and ADF Mobile
An iOS device
Obtain and install Apple iOS Developer Certificates and
Provisioning Profiles. When you deploy your ADF Mobile
application, you must deploy in Debug Mode, using Developer
Certificates and Provisioning Profile.
Here is a short video of how to modify the temporary Xcode project and
use Xcode utilities to display all logging messages from an ADF Mobile
application running on a device.
Debugging using an Android device using Android Debug Monitor is much
simpler to set up. There is no need to work with the temporary
Android application project. Instead, you will just need:
A PC, Mac, or Linux machine supported by the Android SDK
Latest version of Android SDK Tools - this refers to the set of
tools and utilities that are part of the Android SDK. Android
Debug Monitor is part of that.
Oracle JDeveloper and ADF Mobile
An Android-based Device and associated device driver installed
(for PC and Linux Machines)
Please note that the appropriate drivers on PC and Linux are
typically needed for proper connection to the device. If the
machine cannot properly recognize the device, then debugging will not
In addition to what Shay discussed in his blog article, a couple of
additional notes that might be useful if you are looking at
logging messages outside the embedded Java Virtual Machine:
In the LogCat window, set the filter by application ID. You
would see all logging messages related to the application, which
includes events coming from the native part of the application (i.e.
container), Cordova, device services, etc.
You can optionally set your application as a "Debugging
Application" by going to your device Settings-Developer options-Select
debug app, and then select the ADF Mobile application you want to
debug. All applications compiled in "Debug" mode will show up
here. This will allow you to select the ADF Mobile application
process in the Android Debug Monitor app, and perform additional
debugging - most likely much more info than you will ever want (or
care) to know.
Please let us know if there are any issues or questions.