неделя, юни 14, 2009

Android Traceview starting problems


Things to consider when using traceview.bat:

Create a trace file

1. Create AVD with SD card (and there's no problem with trace file generation)

android.bat create avd -n avd_name -t 1 -c C:\the-path-chosen-for-sd-card\my-sdcard-file

If there's no SD card binded with the Virtual Device, the call to
Debug.startMethodTracing();
will throw RuntimeException and the dalvik vm will print in the LogCat: Unable to open trace file '/sdcard/myapp.trace' : Permission denied

2. If AVD is created without SD card

- a command-line option can be set in the the Eclipse launch configuration (Run/Debug) "Target" tab, to tell the emulator to which SD card it should be binded to - e.g. this can be in case an SD card is created manually with the mksdcard.exe command (I couldn't use that, because my Eclipse has a bug and I couldn't see the edit box for command-line parameters in the target tab)

-sdcard /the-path-to-sd-card-file/my-sdcard-file

- another option is both things to be done from command-line -> create the card and start the emulator manually:
mksdcard 128M c:\mypath\my-sd-card-file
emulator -sdcard c:\mypath\my-sd-card-file

If everything is ok, this dialog shouldn't appear when the application makes a call to
Debug.startMethodTracing();

If it does, then most probably, the emulator (AVD) is not started with SD card.

After trace file is created
The trace file should be downloaded from the emulator (or real device) to the computer that shall run traceview:

In Eclipse there's a small button in the right upper corner of the DDMS view (File Explorer) to pull files from the emulator (or real device) file system to the development computer.

From command-line:
adb pull /sdcard/myapp.trace c:\path-where-file-will-be-stored

Finally, to open the file with traceview, the whole path to the file should be specified, as the traceview.bat file changes the working path for itself to work properly and the file cannot be found:

Even if you are in the right directory with the trace file, this will not work:
traceview myapp.trace

Should be:
traceview c:\thepath\myapp.trace

1 коментар:

Анонимен каза...

I would like to more know about it. asthma Read a useful article about tramadol tramadol