我在設備中測試我的代碼,它運行良好。但只要我加入Debug.startMethodTracing("PlaceLocator");
和Debug.stopMethodTracing();
,就會出現問題。由於每個日誌,問題是 -Android調試跟蹤問題
03-25 17:39:43.124: INFO/dalvikvm(5971): TRACE STARTED: '/sdcard/LineGraph.trace' 8192KB
03-25 17:39:43.124: ERROR/dalvikvm(5971): Unable to open trace file '/sdcard/LineGraph.trace': Permission denied
03-25 17:39:43.124: DEBUG/dalvikvm(5971): +++ active profiler count now 0
03-25 17:39:43.124: DEBUG/AndroidRuntime(5971): Shutting down VM
03-25 17:39:43.124: WARN/dalvikvm(5971): threadid=3: thread exiting with uncaught exception (group=0x4001b170)
03-25 17:39:43.124: ERROR/AndroidRuntime(5971): Uncaught handler: thread main exiting due to uncaught exception
03-25 17:39:43.131: ERROR/AndroidRuntime(5971): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.placeLocator/com.android.placeLocator.PlaceLocator}: java.lang.RuntimeException: file open failed
在這裏,我想提一提,我已經在清單中添加<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
,從而使系統可以寫在SD卡中的文件。哪裏有問題?
您確定/ sdcard存在且可寫嗎?你可以「成功地調試垃圾箱/ SD卡/測試」?清單的正確部分是否使用許可? – fadden 2011-03-26 00:14:08