gpt4 book ai didi

java - Proguard 不会删除我的日志

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:04:32 26 4
gpt4 key购买 nike

我想在发布时从日志中清除我的项目。但我正在尝试使用混淆器并且结果为零:我的项目设置:

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-19
android.library.reference.1=..\\google-play-services_lib

还有我的proguard-properties

   -optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-keepattributes LineNumberTable
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

#To remove debug logs:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** w(...);
public static *** i(...);
}


-keep class android.support.v4.** { *; }

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Fragment
-keep public class * extends android.app.ListActivity
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembers class * {
native <methods>;
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keepclassmembers class net.hockeyapp.android.UpdateFragment {
*;
}

-keepclassmembers class * {
public void onClickUpdate(android.view.View);
}

-keep public class javax.net.ssl.**
-keepclassmembers public class javax.net.ssl.** {
*;
}

-keep public class org.apache.http.**
-keepclassmembers public class org.apache.http.** {
*;
}

为什么它不起作用?我正在尝试关闭/打开优化..相同的结果

最佳答案

如果你想让 assumenosideeffects 设置生效,你必须使用 proguard-android-optimize.txt:

将您的 proguard.config 行更改为:

proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt

Eric Lafortune 关于 proguard-android-optimize.txtproguard-android.txt 的更详细描述可以在 here 中找到。

关于java - Proguard 不会删除我的日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21827404/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com