Android 调试跟踪问题

发布于 2024-10-26 18:34:42 字数 1120 浏览 1 评论 0原文

我正在设备中测试我的代码,它运行良好。但是,一旦我添加 Debug.startMethodTracing("PlaceLocator");Debug.stopMethodTracing(); ,就会出现问题。根据日志,问题是-

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

在这里我想提一下,我在清单中添加了 以便系统可以写入文件在sd卡中。问题出在哪里?

I am testing my code in device and it is running fine. But as soon as I am adding Debug.startMethodTracing("PlaceLocator"); and Debug.stopMethodTracing(); , it is giving problem. As per log, problem is-

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

Here I like to mention that I have added <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> in the manifest so that system can write file in sd card. Where is the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暗地喜欢 2024-11-02 18:34:42

你在模拟器上尝试这个吗?如果是这样,您可能需要使用外部存储来配置模拟器。

或者尝试登录 shell 'adb shell' 并尝试在 /sdcard/LineGraph.trace 中创建一个文件。

您可以

回显“某事”> /sdcard/LineGraph.trace

并查看文件是否已创建。

Are you trying this on emulator ? If so you may want to configure your emulator with external storage.

Or try loging into shell 'adb shell' and try to create a file in /sdcard/LineGraph.trace.

You can

echo "something" > /sdcard/LineGraph.trace

and see if the file is created.

晨与橙与城 2024-11-02 18:34:42

根据 http://developer.android.com/guide/developing /debugging/debugging-tracing.html#knownissues,分析和线程存在已知问题。我发现如果我使用任何线程,我的应用程序就会崩溃。

According to http://developer.android.com/guide/developing/debugging/debugging-tracing.html#knownissues, there are known issues with profiling and threads. I found that if I use any threads, my application crashes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文