Reputation: 1729
I have many calls to Log.d()
and System.out.println()
, which I have used for debugging, in my Android application. Are these log messages still visible to anyone who runs the production apk?
Upvotes: 2
Views: 317
Reputation: 60973
All Log
messages still visible to anyone who runs the production apk so you can create a custom class for print all the Log
public class MyLog {
public final boolean ENABLE_LOG = true; // or ENABLE_LOG = BuildConfig.DEBUG
public static void d(String tag, String msg) {
if (ENABLE_LOG){
Log.d(tag, msg);
}
}
public static void e(String tag, String msg){
...
}
...
}
and use
MyLog.d("TAG","test"); // instead of Log.d("TAG","test")
Upvotes: 1
Reputation: 4667
Yes. it is visible to others and retrievable using tools. You can pro grammatically check if it is in debug mode by following code,
if (BuildConfig.DEBUG) {
Log.d(TAG, "xxxx");
}
Thank you
Upvotes: 1
Reputation: 2523
Yes, all log messages are still logged into standard Android logcat, even in release builds.
Upvotes: 1