DDMS integration

Jan Berkel edited this page Nov 15, 2011 · 3 revisions

DDMS integration

The plugin allows to access some of the functionality of DDMS directly from the sbt console.

Getting screenshots

In the sbt console run:

> android:screenshot-emulator


> android:screenshot-device

The screenshots will be written to emulator-timestamp.png / device-timestamp.png in the project root directory.

Fetch hprof memory dumps

> android:hprof-emulator
> android:hprof-device

The resulting file will already be converted to the hprof format and can be directly opened in a profiler.

Inspect the currently running threads

You can inspect the current state of the app (also using tab completion):

> android:threads-emulator <tab>
Binder Thread #1                                                          Binder Thread #2
Compiler                                                                  GC
HeapWorker                                                                JDWP
RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@405afd10   Signal Catcher
Thread-11                                                                 Thread-12
Thread-14                                                                 Timer-0

> android:threads-emulator main
[info] main (state: native, utime: 1420, stime: 580, sampled 0.0 secs ago)
[info] android.os.MessageQueue.nativePollOnce(Native Method)
[info] android.os.MessageQueue.next(MessageQueue.java:119)
[info] android.os.Looper.loop(Looper.java:110)
[info] android.app.ActivityThread.main(ActivityThread.java:3683)
[info] java.lang.reflect.Method.invokeNative(Native Method)
[info] java.lang.reflect.Method.invoke(Method.java:507)
[info] com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
[info] com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
[info] dalvik.system.NativeStart.main(Native Method)