Shay Shmeltzer's Oracle Development Tools Tips

Debugging ADF Mobile Apps on Android

Shay Shmeltzer
Director of Product Management - Oracle

Not that you'll ever need this, after all your code is perfect. But I did run into a situation where I wanted to figure out what exactly is wrong with my ADF Mobile code. The way to do debugging is documented in the ADF Mobile Developer Guide, but here is a version of those instructions with nice pictures (which might make it easier for you to find files etc).

1. First locate the cvm.properties file (In the Application Resources accordion). In this file you'll want to change the value of java.debug.enabled to be true. Also note in this file the value set for java.debug.port,  by default this is 8000 and we are going to keep that default value in our example.

2. Next have a look at your application level deployment profile, or even better create a new deployment profile and call it debugDeploy. The key thing here is to make sure your build mode is in Debug mode and not Release mode (remember the previous post where we told you that Release mode creates a smaller/faster deployment, but right now we do need the bigger package to be able to debug).

3. Next deploy your application with your new debugDeploy profile. We'll assume deployment directly to the device.

4. Now from the command line locate the directory where your Android's SDK adb.exe utility is and issue the following command to let the device (-d) know that we are going to use port forwarding for debug:

adb -d forward tcp:8000 tcp:8000

5. Now on your device start your application. You'll notice that it seems to be stuck, well this is because it is waiting for the debugger to connect to it. So what are you waiting for?

6. In JDeveloper, stand on your viewController project and right click to choose debug. If you changed the port number you'll need to update that info in the dialog that pops up - but if you kept it at the default 8000 we should be ok.

The debugger will now try and connect to your running application, and will stop at the breakpoint you set.

Happy debugging.

By the way if you want to debug on the emulator of Android the only difference will be in step 4 where instead of -d you'll use a -e .

P.S. - you might also be interested in this blog entry about setting up logging on Android with ADF Mobile.

For iOS debugging tips see this blog entry by Joe.

Join the discussion

Comments ( 27 )
  • guest Thursday, January 3, 2013

    really Nice Thanks for sharing .. very clearly discussed and presented.

  • Prabhanjan Nag Wednesday, January 23, 2013

    Hi Shay,

    I have the android phone connected to computer with its debug on.

    Can you put some light on, how to deploy to an android device directly from jdev?

    What all settings are required for jdeveloper to identify the device for deploying?

    Thanks you.

  • shay shmeltzer Wednesday, January 23, 2013

    Prabhanjan, development and deployment is described in our tutorials here:


    As long as you can see your device from your computer as a hard-drive you should be set to have JDev deploy directly to device.

  • guest Thursday, March 7, 2013

    How about debugging in iOS ?

  • Shay Thursday, March 7, 2013

    guest - debugging on iOS should be basically the same without the adb command that is needed for Android.

  • Diego Tuesday, May 14, 2013

    Hi Shay,

    How come my System.out.println() don't work?

    How can I see what is printed in the log console?

  • Shay Tuesday, May 14, 2013

    Diego - System.out.println() won't show up inside JDeveloper - you can start the log monitor for your environment and see it there.

    For Android look under the Android SDK install in the tools directory you'll see ddms.bat file - run it and your SOP will show up there.

  • Diego Tuesday, May 14, 2013

    Hello Shay, thanks for answering,

    I ran the ddms.bat and I get 'The standalone version of DMSS is deprecated. Please use Android device Monitor (monitor.bat) instead.'

    I ran the monitor.bat and It opened an android debud monitor.

    Well I figured out how to get the return object from the WS.

    My Session Facade Bean was returning a CustomBean but the WS method was returning an Object I changed the return type of the WS from Object --> CustomBean

    and that solved my problem, plus when I created my web service data control I put the Port url instead of the WSDL url I dom't know if that has anything to do, but I saw in a tutorial that the WSDL is needed so I changed it

  • Shay Tuesday, May 14, 2013
  • guest Saturday, June 8, 2013

    Dear Shay.

    I am running the command adb -d forward tcp:8000 tcp:8000 from ...\sdk\platform-tools , But i am getting the error (The Android Emulator is running):

    tcp:8000 tcp:8000

    error: device not found

    in addition when i start the debug from Jdev i am getting : .Debugger unable to connect to remote process.

  • shay Tuesday, June 11, 2013

    guest - you might need to issue an : adb -services first to make sure the adb service recognizes the emulator.

  • guest Wednesday, June 26, 2013

    Hi, after following each step, I get this message in the console: unable to connect to debugger. I use 'e' in command prompt and test it in an emulator.

  • guest Tuesday, July 9, 2013


    I got the same error as : "unable to connect to debugger. I use 'e' in command prompt and test it in an emulator."

    Please help me.

  • guest Friday, August 30, 2013

    Hi Shay, I have query on UI Components.How to adjust the components for different screen size devices in android.The application which i have made

    the issue is it appears fine on smaller devices but on high end devices the 1/4th screen appears to be blank.Can you throw some light on this issue.Also how to customize the in built components.

  • Shay Friday, August 30, 2013

    guest - try posting this on the OTN forum.

    If you are targeting both phones and tablets you might want to consider developing two separate interfaces in the same project and using constraints to decide which UI is shown.


  • guest Monday, September 2, 2013

    Hi shay thanks for responding.I am targeting only phones but of different screen sizes.For e.g. Samsung (galaxy ace,Note,S4) ,Google (Nexus ,Nexus 4),HTC(Sensation,Butterfly).These phones are of different screen sizes.The UI Which i am making looks fine on some of these devices but on rest it leaves some part blank @ bottom of screen . I wanted components to stretch in terms of width according to screen sizes as we can do in native android development.If you can provide me email i can send you pics to better understand my question.Thanks.

  • Shay Wednesday, September 4, 2013

    guest, Have a look at the layout demo that comes with the ADF Mobile demos for some techniques.

    Many components will stretch based on the component that contains them.

    For others you can use a specific stylesheet to force their size.

  • guest Wednesday, September 4, 2013

    Hi shay still not able to do the required task.One more issue which i am facing is functionality point of view.I want camera to take a picture when user clicks on "Take Picture" button.And when photo is taken preview is to be displayed on the same page below "Take Picture" button.The issue i am facing is as soon as application starts ,DIRECTLY STARTS CAMERA & preview of image is shown.what i wanted was , when i click on "Take Picture" button , it should open camera & then show preview.Help is appreciated.

  • Shay Monday, September 9, 2013

    Guest, try and see if it works properly when you remove the image preview from your screen.

    My guess is that it tries to render the preview when the app loads and therefor directly tries to take a picture.

    If you put the preview on another page, or if you'll only make it visible after you took the picture it should behave.

    By the way - for faster answers post your questions on the OTN ADF forum.

  • guest Saturday, September 14, 2013

    Unfortunately could not connect debugger to example application (LifecycleEvents) neither on the emulator nor on the device (I tried Nexus 7 with Android 4.3.3).

    In all cases application do appears to be stuck waiting for something but JDev says "Debugger unable to connect to remote process".

    I tried to use localhost (as indicated in your post) as well as ip of the device (as indicated in the manual). In all cases the result the same. I tried port 8000 and 4000.

    More, I tried several example applications without any success.

    On device i do see that application is listening on port 4000 and I can ping my device over wifi but jdev still unable to connect.

    From posts here it looks like I am not alone, right?

    What can be wrong?

  • Diego Tuesday, February 4, 2014


    I tried that command in linux-ubuntu it tells me the adb command not found

  • Shay Tuesday, February 4, 2014

    Diego - you need to execute the command from the directory that contains the adb utility under your Android SDK installation.

  • Diego Tuesday, February 4, 2014

    Hi, I couldn't find it I searched for adb

    and I got this file adb_has_moved.txt

    The adb tool has moved to platform-tools/

    If you don't see this directory in your SDK,

    launch the SDK and AVD Manager (execute the android tool)

    and install "Android SDK Platform-tools"

    Please also update your PATH environment variable to

    include the platform-tools/ directory, so you can

    execute adb from any location.

  • guest Monday, March 3, 2014

    For those having problems connecting the debugger to the emulater - I was having the same issue. Double-checked my cvm.properties, "debug" release, port number. The emulator was clearly waiting. So I ran the "adb -e forward tcp:8000 tcp:8000" twice - and suddenly the debugger could continue. Strange, but for what it's worth, that worked for me.

  • Sumit Sahay Monday, March 24, 2014

    Hi Experts,

    I’m programmatically trying to use Base 64 encoding for one of my restful service call.

    For this, I created a Custom Application in Jdev (version and included jersey jar ‘jersey-core-1.1.5.jar’ from inside $MW_HOME/jdeveloper/jersey/1.1.5/lib

    Below details..

    import com.sun.jersey.core.util.Base64;



    byte[] bytes = com.sun.jersey.core.util.Base64.encode(auth);

    My java version is It worked in java SE environment

    Now, I tried to do the same in ADF mobile project in same jdev settings. However, I am getting error - “com/sun/jersey/core/util/Base64” (Unsupported major.minor version 49.0)

    I am using same parameter as stated above, however under – Libraries and Classpath (under project properties I can see) – CVM_JDK profile (which uses libraries from jdev extensions.)

    I understand, the unsupported exception will come when it’s compiled with higher version and run in lower version.

    Can you suggest, please.?



  • guest Tuesday, March 25, 2014

    Sumit, ADF Mobile uses JDK 1.4 - you can't bring in JDK 6 libraries into it.

  • guest Friday, May 30, 2014

    This is debugging is with the device hence we are using (-d). But if I want to debug with the emulator then what should be the cmnd I shud give in cmd. Help me.

    Thanks in advance

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.