Question

I have a proguard.cfg file which contains several statements including optimization passes and logs suppression as :

-assumenosideeffects class android.util.Log { *; }

-assumenosideeffects class com.badlogic.gdx.Application {
    public static void debug(...);
    public static void error(...);
    public static void log(...);
}

Calls to Log.* are correctly removed in the final output APK file. But gdx log calls are still in the code. For example I can still see things like that in the output :

Gdx.app.debug("debug()", "^");
Gdx.app.error("error()", "^");
Gdx.app.log("log()", "^");

I also tried to put this part of my config in a proguard-optimize.txt file as I have seen on similar questions and then setting the proper value in project.properties files like this : proguard.config=proguard-optimize.txt:proguard.txt but it doesn't work !

These calls get removed only if I put a general wildcard :

-assumenosideeffects class com.badlogic.gdx.Application {
    *;
}

But I don't want to remove calls to other Application's static methods, like add* and get*() ones.

Optimization step is enabled (6 passes).

Was it helpful?

Solution

Gdx.app.debug is not static its an instance method (app is a static field of the Gdx class).

Try:

-assumenosideeffects class com.badlogic.gdx.Application {
    public void debug(...);
    public void error(...);
    public void log(...);
}

OTHER TIPS

Try something like this in your application's code:

Gdx.app.setLogLevel(Application.LOG_NONE);

That will prevent messages from being logged.

Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top