Android原生code调试 [英] Android Native Code Debugging

查看:113
本文介绍了Android原生code调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能获得本地C ++程序的COUT输出上的日志,猫android应用开发在eclipse。

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

请人帮助我在这里。

推荐答案

在标准输出/标准错误文件描述符在Android应用程序发送到的/ dev / null的。 (Jav​​a的等价物,的System.out System.err的,被重定向到日志的应用程序框架。)

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.)

Dalvik虚拟机包括一个黑客工具,将让你看到标准输出/标准错误一个植根设备上通过设置 log.redirect-标准输入输出属性。请参见的详细信息,此链接。它通过启动一个线程读取从标准输入输出文件描述符,并将数据复制到日志记录系统。

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.

有关新的code,它更容易直接使用Android的日志调用。如果你从其他地方进口图书馆,当然,这是一个有点困难。如果有必要,你可以复制的code OUT的Dalvik <的/一>,进入您的应用程序,并把它做同样的事情。

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.

这篇关于Android原生code调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆