Read logs from all apps on android from within an app for android 4.2+

Unless you rooted you cannot do this since Jelly Bean. See this Android bug report and this related discussion. Quote: The change is that third party applications can no longer get the read logs permission, however every app can read the logs containing only the lines they have written, without needing any permission. Keep in … Read more

Saving Logcat to a text file in Android Device

Use an Application class at the beginning of your app. That allows a proper file and log handling. Code below creates a log file at the following location: /ExternalStorage/MyPersonalAppFolder/logs/logcat_XXX.txt XXX is the current time in milliseconds. Every time you run your app, a new logcat_XXX.txt file will be created. public class MyPersonalApp extends Application { … Read more

Android Studio – ADB Error – “…device unauthorized. Please check the confirmation dialog on your device.”

you have missed the Fingerprint Certificate Authorization dialog in your phone when you connected it, try to change the USB mode to Media, or another different than the one you have in and then reconnect your device, or go to Developer Options -> Revoke USB Debugging and reconnect, watch for the dialog and click on … Read more

Eclipse logcat debugging

After you see FATAL EXCEPTION: main you will see the problem, here a NPE 09-23 11:27:55.968: E/AndroidRuntime(807): java.lang.NullPointerException then you find the first line that references your app. Here it is the following line at com.uniqueapps.runner.Start.onClick(Start.java:49) This says that in Start.java something is null in onClick() at line 49. So you go to that line … Read more

How to exclude certain messages by TAG name using Android adb logcat?

You can do this from within DDMS Monitor (and also Eclipse or Android Studio) with the regular expression input box and negative look-ahead assertions, for example I am excluding a lot of noise from my log with the following: tag:^(?!(WifiMulticast|WifiHW|MtpService|PushClient)) (The “tag:” isn’t part of the regular expression, but tells LogCat to only apply the … Read more

Disable LogCat Output COMPLETELY in release Android app?

You can use ProGuard to remove completely any lines where a return value is not used, by telling ProGuard to assume that there will be no problems. The following proguard.cfg chunk instructs to remove Log.d, Log.v and Log.i calls. -assumenosideeffects class android.util.Log { public static *** d(…); public static *** w(…); public static *** v(…); … Read more

What do GC_FOR_MALLOC, GC_EXPLICIT, and other GC_* mean in Android Logcat?

GC_FOR_MALLOC means that the GC was triggered because there wasn’t enough memory left on the heap to perform an allocation. Might be triggered when new objects are being created. GC_EXPLICIT means that the garbage collector has been explicitly asked to collect, instead of being triggered by high water marks in the heap. Happens all over … Read more