我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
我昨天安装了Android Studio,我试着用LogCat查看日志。但是日志里什么都没有。我使用终端运行。/adb logcat,它工作。
有人能给我解释一下如何在Android Studio中使用logcat吗?
当前回答
首先确保在您的设备中启用了开发人员选项。 设备已连接。 详细的。 只显示选中的应用程序。
其他回答
我刚把它修好了。在DDMS显示的最右边寻找恢复Devices Logcat视图和ADB视图的小图标。
When the DDMS first came up with both the "ADB Logs" and the "Devices | logcat" tab showing. The "Devices | logcat" is the one that should be showing the device output, but was blank. Somehow I managed to hide one or the other of those tabs, I forget exactly how. But, off to the right there was a tiny icon that said "Restore ADB" view, and I clicked it and it came up. Then there was another tiny icon that said "Restore Devices logcat view". I clicked that, and all of a sudden it appeared and was showing the device output again.
确保您导入了正确的类
import android.util.Log;
在终端中执行此命令。它将重新开始工作。
adb kill-server && adb start-server
我的问题解决了,在我添加android:debuggable="true"下应用程序在你的androimanifes .xml(甚至ide标记为错误的语法!????)
我的手机上有一个自定义ROM,由于某种原因没有输出logcat,但是模拟器和另一个设备可以输出。擦除并安装ROM使logcat重新工作。