Skip to main content

How to remove log completely in release version in Android

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(...);
    public static *** i(...);
}
The end result is that these log lines are not in your release apk, and therefore any user with logcat won't see d/v/i logs.

ref. http://stackoverflow.com/questions/5553146/disable-logcat-output-completely-in-release-android-app

Comments

Popular posts from this blog

How to test AsyncTask in Android

In Android, test is not as easy as any other platform. Because Android test cannot be run without emulator. Particulary when it comes to AsyncTask or Service, it is difficult to test because they are different type of thread and hard to check their result. Then, how can we ensure the result of AsyncTask valid? AsyncTask is a thread and an asynchnorous as the name means. So, we need to wait for it finishes its job and need to capture the event. Then, when it happens in AsyncTask. It can be one of onBackground() and onPostExecute() methods. It doesn't matter you use onBackground() or onPostExecute() but I prefer onPostExecute(). Anyway, we can test an AsyncTask if we can hook it. Then, how can we hook it? For that, we can use callback pattern. But we need to delay main thread to wait for the AsyncTask's job done because we want to check the result. So the structure for the test would be like: 1. Create AsyncTask A 2. Injection a callback into A 3. Wait until A finish 4....

Apply Kotlin DataBinding to Android Studio Generated Main Activity

I posted how to setup Kotlin and DataBinding in Android Stuido in the last blog (http://marksunghunpark.blogspot.com.au/2017/04/kotlin-binding-library-setup-in-android.html). In this post, I am going to how to use DataBiding in the MainActivity when you create a navigation drawer project from Android Studio templates. Layouts You will have four layouts in app/src/res/layout folder: app/src/main/res/layout/activity_main.xml app/src/main/res/layout/app_bar_main.xml app/src/main/res/layout/content_main.xml app/src/main/res/layout/nav_header_main.xml And activity_main.xml contains all other layout using include layout. You need to have tag in activity_main.xml , app_bar_main.xml and content_main.xml . If you don't have the tag, Binding library cannot recognise the sub layouts properly. Binding library doesn't support toolbar and navigation drawer yet, so you can use using BindingAdapter if you want to use binding library.(But I'm gong to skip this part for simplici...

How to setup RetroLambda, Roboletric and RxAndroid together in Android Studio

Testing environment Before you proceed the process, Java 1.8 should be installed first in your system. Here is my testing system: OS: MacOSX Yosemite(Version 10.10.3) Android Studio: Version 1.2 Java SDK: Version 1.8.0_45 Project structure /Project /app /src /main /java AndroidManifest.xml /testDebug /java build.gradle /build /gradle build.gradle Configuration /Project/build.gradle Add dependencies for retrolambda and robolectric plugins under dependencies block. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.2' classpath 'me.tatarka:gradle-retrolambda:3.1.0' classpath 'org.robolectric:robolectric-gradle-plugin:1.0.1' } } allprojects { repositories { jcenter() } } Configuration /Project/app/build.gradle apply plugin: 'co...