Debugging MAF Mobile Apps for Andriod Developers: Using Monitor

Debugging MAF Mobile Apps for Android  Developers: Using Monitor

Debugging ADF Mobile applications can be a chore and under Android SDK environments even more so. I will be embarking to document and share my experiences with the framework and battling with my self inflicted issues, knowing that the framework is complete and fault free!

So, my mantra for the series will be that the is no problem like one you've created for yourself.

 A little about my environment: I am running on Ubuntu 14.04 LTS (recently upgraded) and various versions of the Mobile Application Framework. I will continue to update my Android SDK and supporting technologies, so hopefully things will improve as we progress.

Getting to know your Android Development Tools

The Android Device Monitor


The Android SDK provides several tools and applications to aide in mobile application development and key to all development activities debugging is essential. Tracing your code, the application resources, and logging messages to help resolve issues or view progress of your app. The Android Debug Monitor or Device Monitor depending on your platform, version or splash screen and title it one of the tools to assist in this area. The Android Studio is currently in Beta but will also offer and possibly replace the Monitor in the future.

Once started the Monitor provides several panes or views.

Android Debug Monitor or Device Monitor

Devices: A list of connected devices or running emulators

Dalvik Debug Monitor Server (DDMS): Several embedded views and panes to monitor device resource usage, files, network and allocations

LogCat: Area to view trace messages, this is the primary area for us will be the LogCat which is the standard output of all logging messages.

Console: Console view

Viewing Device and Application Log Information 

Step 1: Ensure your device is connected and configured for Remote Debugging or that your emulator is up and running and your application has been successfully deployed.

Step 2: Start the monitor:

[Android SDK path - SDK_HOME = /apps/androidSdk]

$SDK_HOME/tools/monitor &

==For Windows users, do what is best on windows, DoubleClick and wait ;)

Step 3: Once Monitor is started, select your device in the Device pane, it should already show the running application services, like media, camera of system UI, etc.

Step 4: Open the LogCat and add new filter in the saved filters, this will remove all the un-wanted messages.

Step 5: Get your application Bundle ID

MAF Application Settings

Android Deployment Profile

 If these are different update them, to simply debugging, and re-deploy your application.

Step 6: Set the Filter Name, this can be specific to your application or generic that fits all of the applications you will create - MAF Apps

Step 7: Set the by Application Name, this will be the bundle id and you should set this in the maf-application.xml and confirm the value in the android deployment profile, I recommend setting these to be the same.

Step 8: Start the application on the device, with the filter in place only messages from your applications will show.

Step 9: Use the Search window to query for relevant messages. Get to know the TAGs under which messages are placed will be very helpful.

Search for:

 any system out and logged messages from the app
 CordovaWebView  messages related to HTML page/view requests
PhoneGap related messages
 dalvikvm  virtual machine related information, heap, memory allocations etc.

Step 10: Review the log messages

You may save these or further refine your search to help isolate the root cause of your issue.

Other Items of Interest in the Monitor

The monitor also provides some interesting views as far as resource usage, if your interested, from thread details, memory allocations, CPU loads and more. For me the File Explorer is one that provides some added value to view the application internal storage and gaining access to the created SQLite database.

Select the File Explorer tab under the DDMS perspective view.  Navigate the data folder to your application files: /data/data/<app_bundle_id>/files

Select your SQLite database file and the click the disk icon to save /export the file to your local file system and use your preferred tool to view the information in the database. If the database is encrypted then provide the password on connection.

File Explorer Pane

Well those are the basics to using the Android Debug Monitor or Device Monitor and I hope you will find this useful.

Happy Debugging



Post a Comment:
  • HTML Syntax: NOT allowed

This blog is is dedicated to announcements,tips and tricks and other items related to developing, integrating, securing, and managing mobile applications using Oracle's Mobile Platform. It is created and maintained by the Oracle Mobile product development team.

Archive of past entries

Even More Mobile Development Blogs

Oracle A-Team Site - Mobile Related Entries

Code samples from the Community

Fusion Middleware Blogs


« June 2016