how to use -assumenosideeffects class android.util

2019-04-08 12:37发布

I write -assumenosideeffects class android.util.Log in my app. but how to use this.

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

in proguard.cfg file. but not working.

5条回答
何必那么认真
2楼-- · 2019-04-08 13:11

The below one works exactly

-assumenosideeffects class android.util.Log {

public static *** d(...);

}

Similarly you can use i, v and e.

查看更多
我想做一个坏孩纸
3楼-- · 2019-04-08 13:13

Forgot 'public' access modifier?

-assumenosideeffects public class android.util.Log
查看更多
祖国的老花朵
4楼-- · 2019-04-08 13:20

The manual says -assumenosideffects is "Only applicable when optimizing".

${sdk.dir}/tools/proguard/proguard-android.txt says: "Optimization is turned off by default. Dex does not like code run through the ProGuard optimize and preverify steps".

http://researcharea.blogspot.com/2012/04/assumenosideeffects-not-working-in.html

查看更多
啃猪蹄的小仙女
5楼-- · 2019-04-08 13:30

According to @Sean Owen and @Yevgen Kulik.

In Gradle, use this:

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

Then add below to your proguard-rules.pro

-assumenosideeffects class android.util.Log { public * ; }
查看更多
相关推荐>>
6楼-- · 2019-04-08 13:30

Try -assumenosideeffects class android.util.Log { public * ; }. If that doesn't work, post why you think it isn't working.

查看更多
登录 后发表回答