57

I'm switching my development environment from Eclipse to Android Studio these days. And I really enjoy its autocompletion and many other features this IDE provide. However, I have some problem when doing debugging.

I hope to use Monitor tool which this IDE provided, self-included DDMS and very nice visual interface to track memory usage, thread condition and so on. But I can't find a way that this could support step by step using breakpoints I have to create (That red dot in editor)

I can only do step by step debug by not open this Monitor. Since when I try to use Monitor while the debugger is running, it will popup a window asking me to disconnect the ADB first. I also can't find a place to start the application from Monitor.

Is there a way to do step by step debug while using Monitor at the same time in Android Studio?

1
  • 1
    I'm using version 1.0.1 and still the same issue. Did you ever get to figuring it out? I noticed, that you can tracing and tracking in the little window (Android DDMS) but cannot see hierarchy view and stuff?
    – Ratan
    Jan 9, 2015 at 21:45

7 Answers 7

69

Go to

Tools > Android > Android Device Monitor

in v0.8.6. That will pull up the DDMS eclipse perspective.

how to open

3
  • 4
    it will break the running adb connection
    – Apperside
    Apr 7, 2015 at 9:36
  • It doesn't work. It opens but when we select a process it doesnt allow to put debugger on the selected process. :( Jun 25, 2015 at 6:32
  • 3
    There is no option android in tools for latest version of android studio 2.0 Stable release
    – Prasad
    Apr 18, 2016 at 5:07
4

I think things (location) have changed little bit. For: Android Studio 1.2.1.1 Build @AI-141.1903250 - built on May 5, 2015

Franco Rondinis answer should be

To track memory allocation of objects:

  1. Start your app as described in Run Your App in Debug Mode.
  2. Click Android to open the Android DDMS tool window.
  3. Select your device from the dropdown list.
  4. Select your app by its package name from the list of running apps.
  5. On the Android DDMS tool window, select Memory tab.
  6. Click Start Allocation Tracking Interact with your app on the device. Click Stop Allocation Tracking (same icon)

how to start allocation tracking in android studio 1.2.1.1

0
2

As far as I know, currently (Android Studio 2.3) there is no way to do this.

As per Android Studio documentation:

"Note: Only one debugger can be connected to your device at a time."

When you attempt to connect Android Device Monitor it disconnects Android Studio's debug session and vice versa, when you attempt to connect Android Studio's debugger, it disconnects Android Device Monitor.

Fortunately the new version of Android Studio (3.0) will feature a Device File Explorer that will allow you to pull files from within Android Studio without the need to open the Android Device Monitor which should resolve the problem.

0

Could it be a problem with past preview versions of Android Studio ? nowadays "beta" has replaced the "preview". I try it out step by step debugging while using Memory Monitor at same time by Android Studio (Beta) 0.8.11 on OSX 10.9.5 without any problems.

The tutorial Debugging with Android Studio also helps, specially this paragraph :

To track memory allocation of objects:

  1. Start your app as described in Run Your App in Debug Mode.
  2. Click Android to open the Android DDMS tool window.
  3. On the Android DDMS tool window, select the Devices | logcat tab.
  4. Select your device from the dropdown list.
  5. Select your app by its package name from the list of running apps.
  6. Click Start Allocation Tracking Interact with your app on the device. Click Stop Allocation Tracking

Here a couple of screenshot while debugging step by step on a breakpoint a monitoring the memory on the emulator:
breakpointmemory monitor

0

I think that I got a solution for this. You don't have to start monitor but you can use DDMS instead almost like in Eclipse.

Start Android Studio-> pick breakpoint-> Run-> Debug-> Go to %sdk\tools in Terminal window and run ddms.bat to run DDMS without Monitor running (since it won't let you run ADB). You can now start profiling or debug step-by-step.

Hope this helps you.

See image here

1
  • You should correct your answer instead of putting the correction in the comment. Saves people time in future when they would otherwise make the mistake of following what they see on top then realize the correct answer is hidden in the comments.
    – Aen Tan
    Feb 25, 2015 at 18:38
0

1 use eclipse bar to install a Mat plug-in to analyze, is a good choice. Studio Memory provides the Monitor 2.Android studio to display the memory occupancy of the application in real time.

0

From Android Studio 3.1 only command line can open Android Device Monitor

monitor

The reason is that Google improves debug/monitoring/inspection tolls every release. That is why you can use:

  • Debug
  • Layout inspector
  • Databace Inspector
  • Device File Explorer
  • Profiler
  • ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.