问题描述
我正在使用Android Studio 2.3,而我的手机是Huawei P9 Lite.我注意到我的logcat没有显示手机中的错误.例如,如果我有由于NullPointerException
而崩溃的代码,并且在模拟器上运行它,则logcat(字体颜色:红色)中会出现异常,弹出窗口会显示MyApplication stopped working
,但是如果我在手机上运行相同的代码,我只是出现崩溃弹出窗口,而logcat中什么也没有.显示信息消息,但不显示错误.为了在logcat中显示手机中的错误消息,我该怎么办?
I am using Android Studio 2.3 and my phone is Huawei P9 Lite. I noticed that my logcat does not show errors from my phone. For example if I have code that will crash because of NullPointerException
and I run it on emulator I get exception in logcat (font color: red) and popup saying MyApplication stopped working
, but if I run same that code on my phone, i just get crash popup and nothing in logcat. Info messages are displayed, but errors are not. What do I need to do in order to show error messages from my phone in logcat?
推荐答案
华为禁用LogCat以及对手机日志的任何访问权限.您应该转到一个隐藏菜单,您可以在其中启用这些功能.
Huawei disables LogCat and any access to the logs of your phone. You should go to a hidden menu where you can enable these functions.
- 打开Dialer应用并输入以下代码:*#*#2846579#*#*.
- 进入背景设置页面.
- 点击"日志设置"
- 选中所有 3个选项以启用完整日志记录.
- 忽略将影响性能"警告.
- 重新启动手机.
- Open your Dialer app and enter the following code: *#*#2846579#*#*.
- Enter the Background Settings page.
- Click on "Log Settings"
- Check all 3 options to enable full logging.
- Ignore the "will affect performance" warning.
- Reboot the phone.
这对我有帮助,希望对您也有帮助.
This helped me, hope it will help to you, too.
来源: https://www.xda-developers.com/huawei-phones-disable-logcat-heres-how-to-restore-access/
这篇关于Logcat没有显示来自我的Huawei P9手机的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!