Reputation: 101
logcat in Android Studio is not showing my generated outputs via Log.v/.d
or any stacktraces after an unhandled runtime exception (like a nullpointer) and no further information when the app crashes. Log.i/.w/.wtf/.e
messages are sometimes shown. Also selfgenerated
messages from Android classes are shown (only sometimes!) and Android system outputs(normally always shown in logcat).
logcat filter settings are on "verbose" and "no filter" or "show only selected application" (both not solving my problem). Nothing entered in the searchmask. Restarting didn't solve the problem.
I tried out different smartphones and emulators with Android 5.1/6 and several projects/apps.
Example code (only more important messages than debug are shown):
@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");
}
Edit: logcat output for the code above (with "verbose" & "show only selected applictaion" filter options):
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
Upvotes: 3
Views: 1453
Reputation: 41
This happens quite often, change logcat filter settings to "verbose" and "show only selected application", this works for me, I hope it works for you too.
Upvotes: 2
Reputation: 1368
Is the same problems observed if you are debugging your app on emulator or some other device? If not, you may need to change the device's logging output level. Which is somehow lowered while you are actually debugging the app by Android Studio, but then reset to default phone's level once it's crashed.
Another fix would be to start using some log4j based logger (e.g. logback) and config it to write logs to file at your desired level. You can also catch Thread.UncaughtExceptionHandler and send logs to email or server if app crashes (on next app's start).
Upvotes: 0
Reputation: 105
It's common problem. Check that you have connected right device, you are debugging right process, clear filter bar.
Upvotes: 0