Morshues
Morshues

Reputation: 135

Android disable logcat I/System of command process

I use Process to run command line instruction.

When I run an instruction, application will show "I/System﹕ exec(MY_INSTRUCTIONS)" on logcat.

But because I'm developing a private SDK for other people, so I must disable the messages on logcat.

My code looks like:

String[] command = {"ls", "-rf"};
ProcessBuilder pb = new ProcessBuilder(command);
try {
    Process process = pb.start();
} catch (IOException e) {
    e.printStackTrace();
}

And the logcat message looks like:

I/System﹕ exec(ls -rf @ com.mypackage.MainActivity.cli:152)

I know the proguard can remove all the log message, but disable "android.util.Log" message could not correctly disable this system message.

Please help me to disable this logcat message or remove the messages by proguard.

Upvotes: 1

Views: 641

Answers (1)

Murtaza Khursheed Hussain
Murtaza Khursheed Hussain

Reputation: 15336

In proguard you can add these enteries

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** w(...);
    public static *** v(...);
    public static *** i(...);
}

Upvotes: 1

Related Questions