在Android Studio中,logcat无法显示我通过
Log.v/.d
生成的输出或任何未处理的运行时异常(例如nullpointer)后的堆栈跟踪,当应用程序崩溃时也没有进一步的信息。有时会显示Log.i/.w/.wtf/.e
消息。还会显示来自Android类的selfgenerated
消息(仅有时!),以及Android系统输出(通常在logcat中始终显示)。
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输出(使用“详细”和“仅显示选定应用程序”过滤器选项):
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