Wednesday, April 14, 2010

Unable to open trace file '/sdcard/Mytwitter.trace': Permission denied

in android, you can enable trace by adding code like
Debug.startMethodTracing("mm.trace");

then the system will dump one big tracefile to /sdcard/mm.trace

at first, you may get error like

Unable to open trace file '/sdcard/mm.trace': Permission denied

when you view the permission, it's fine.

the trick is that start from 1.6, it need one permission so tat you could write something to sdcard

the permission is
android.permission.WRITE_EXTERNAL_STORAGE

public static final String WRITE_EXTERNAL_STORAGE

Since: API Level 4
Allows an application to write to external storage
Constant Value: "android.permission.WRITE_EXTERNAL_STORAGE"

No comments: