Android Native Code Debugging

后端 未结 1 1977
渐次进展
渐次进展 2020-12-21 04:08

How can I get the cout output of the native c++ program on the log-cat in android application development in eclipse.

Please someone help me here.

相关标签:
1条回答
  • 2020-12-21 04:42

    The stdout/stderr file descriptors are sent to /dev/null in Android apps. (The Java equivalents, System.out and System.err, are redirected to the log by the app framework.)

    The Dalvik VM includes a hack that will let you see stdout/stderr on a rooted device by setting the log.redirect-stdio property. See this link for details. It works by starting a thread that reads from the stdio file descriptors and copies the data to the logging system.

    For new code, it's much easier to use the Android log calls directly. If you're importing a library from elsewhere, of course, it's a bit harder. If necessary you could copy the code out of Dalvik and into your app and have it do the same thing.

    0 讨论(0)
提交回复
热议问题