2016-12-02 72 views
2

logcat的未显示经由Log.v/.d我的输出信息和未处理的运行时异常(如空指针)后的任何踪迹并没有进一步的信息时,应用程序崩溃。有时会显示Log.i/.w/.wtf/.e消息。还显示了来自Android类的selfgenerated消息(仅有时!)和Android系统输出(通常始终以logcat显示)。logcat的没有显示在Android Studio中调试消息

logcat的过滤器设置“详细”和“无过滤器”或“只显示选定的应用程序”(既没有解决我的问题)。搜索框中没有输入任何内容。重新启动并没有解决问题。

我尝试了不同的智能手机和仿真器与Android 5.1/6和几个项目/应用程序。

实施例的代码(仅比调试更重要的信息被示出):

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main2); 
    Log.v(TAG, "verbose test"); 
    Log.d(TAG, "debug test"); 
    Log.i(TAG, "info test"); 
    Log.w(TAG, "warn test"); 
    Log.wtf(TAG, "what a terrible failure test"); 
    Log.e(TAG, "error test"); 
} 

编辑:logcat的输出为上面的代码(用“详细” &“只显示所选applictaion”过滤器选项):

12-02 22:01:13.531 14717-14717/? I/art: Late-enabling -Xcheck:jni 

12-02 22:01:13.593 14717-14730/de.kinoblub.testapp E/HAL: load: id=gralloc != hmi->id=gralloc 

12-02 22:01:13.621 14717-14717/de.kinoblub.testapp W/System: ClassLoader referenced unknown path: /data/app/de.kinoblub.testapp-1/lib/arm64 

12-02 22:01:13.624 14717-14717/de.kinoblub.testapp I/InstantRun: Instant Run Runtime started. Android package is de.kinoblub.testapp, real application class is null. 

12-02 22:01:13.717 14717-14717/de.kinoblub.testapp W/System: ClassLoader referenced unknown path: /data/app/de.kinoblub.testapp-1/lib/arm64 

12-02 22:01:13.837 14717-14717/de.kinoblub.testapp I/HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl 

12-02 22:01:13.883 14717-14717/de.kinoblub.testapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 

12-02 22:01:14.031 14717-14717/de.kinoblub.testapp I/de.kinoblub.testapp.Main2Activity: info test 

12-02 22:01:14.031 14717-14717/de.kinoblub.testapp W/de.kinoblub.testapp.Main2Activity: warn test 

12-02 22:01:14.031 14717-14717/de.kinoblub.testapp E/de.kinoblub.testapp.Main2Activity: what a terrible failure test 

12-02 22:01:14.044 14717-14717/de.kinoblub.testapp E/de.kinoblub.testapp.Main2Activity: error test 

12-02 22:01:14.067 14717-14717/de.kinoblub.testapp I/HwSecImmHelper: mSecurityInputMethodService is null 

12-02 22:01:14.167 14717-14747/de.kinoblub.testapp E/HAL: load: id=gralloc != hmi->id=gralloc 

12-02 22:01:14.167 14717-14747/de.kinoblub.testapp I/OpenGLRenderer: Initialized EGL, version 1.4 

12-02 22:01:14.235 14717-14717/de.kinoblub.testapp I/HwSecImmHelper: mSecurityInputMethodService is null 

回答

0

这是常见的问题。 检查您是否连接了正确的设备,您正在调试正确的过程,清除过滤条。

+0

一切完成,没有任何帮助:( – False

0

如果您在仿真器或其他一些设备调试你的应用程序中观察到了同样的问题?如果没有,您可能需要更改设备的日志输出级别。当您实际上是通过Android Studio调试应用程序时,它会以某种方式降低,但一旦崩溃,就会重置为默认手机级别。

另一个解决方法是开始使用一些基于log4j的记录器(例如logback)并将其配置为将日志写入文件中所需的级别。如果应用程序崩溃(在下一个应用程序的启动时),您还可以捕获Thread.UncaughtExceptionHandler并将日志发送到电子邮件或服务器。

2

发生这种情况经常,以“详细”,改变logcat的过滤器设置“仅显示选定的应用程序”,这部作品对我来说,我希望它为你的作品了。

+0

“Verbose”被选中,“只显示选定的应用程序”也不起作用 – False

+0

尝试使缓存无效并重启,然后将logcat设置为“verbose”和“仅显示选定的应用程序”。 – Samurai21

+0

完成。没有帮助:( – False