3

I have tried using:

-assumenosideeffects class android.util.Log {
    public static boolean isLoggable(java.lang.String, int);
    public static int v(...);
    public static int i(...);
    public static int w(...);
    public static int d(...);
    public static int e(...);
}

in Proguard to remove logs, and it works great if I'm not using the new Jack compiler

defaultConfig {
    ...
     jackOptions {
         enabled true
     }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

When I compile the apk, I have noticed all logs being active in production release. Is there an error, bug or is "-assumenosideeffects" not supported yet?

Can I do something else te remove strings from logs in the final apk ?

jdek
  • 891
  • 7
  • 20
Antonio
  • 363
  • 3
  • 6

1 Answers1

1

When using the Jack compiler toolchain, ProGuard will not be used. Instead, Jack will use its own tool to apply the specified rules.

Not all ProGuard rules are supported (see supported directives): -assumenosideeffects is not supported.

Note: DexGuard, the commercial variant of ProGuard supports all directives from ProGuard and can be used in combination with Jack starting from version 7.2, to be released in 1-2 weeks.

T. Neidhart
  • 6,060
  • 2
  • 15
  • 38
  • Yes, but if you take a look in https://source.android.com/source/jack.html you can see that -assumenosideeffects is listed on the "Ignored options" but is not working, or not implemented yet. – Antonio Jun 21 '16 at 14:20
  • Jack will not throw an error when encountering such a rule, but it will do nothing with it, that's what I meant with not supported. – T. Neidhart Jun 21 '16 at 14:25
  • So **Jack** causes security holes in production APKs? – IgorGanapolsky Nov 03 '16 at 15:13