Cannot use the dump HPROF file function
I want to track the memory leaks of my application. But when I want to press the dump HPROF file button from the DDMS, I get an error message saying that: "hprof: can't open /sdcard/com.google.an开发者_开发技巧droid.apps.uploader.hprof-hptemp: Permission denied." How can I fix this?
Yes.
Connect to your emulator/device using ADB.
Then make the catalog world writable, using chmod 777
You can also add the permission WRITE_EXTERNAL_STORAGE to your manifest file.
Read the instructions here: http://www.netmite.com/android/mydroid/2.0/dalvik/docs/heap-profiling.html
DKIT absolutely has the right answer. However, if you follow that suggestion and still have problems, make sure that your SD card is not mounted on your PC while plugged in over USB. If your SD card is mounted, your process won't be able to gain write access to the card to dump the hprof.
If you are using an emulator, you also need to be sure that your virtual device has an SD Card configured. Just open up the Android Virtual Device Manager, select your AVD and click "Edit...". Then just make sure you have a size entered for your virtual SD card.
精彩评论