相关疑难解决方法(0)

Android Proguard没有删除所有日志消息

我想创建一个混淆的Android应用程序.我使用ProGuard.我想自动删除所有Log.*消息.我怎样才能做到这一点?我找到了这篇文章,但我还是得到了它们.(我使用反编译器来检查混淆).
proguard-project.txt如下:

-injars       libs/In.jar
-outjars      libs/Out.jar
#-libraryjars  <java.home>/lib/rt.jar
-libraryjars C:/Users/thomas/android-sdks/platforms/android-7/android.jar

-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
                SourceFile,LineNumberTable,*Annotation*,EnclosingMethod

-keep public class * {
    public protected *;
}

-keepclassmembernames class * {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String, boolean);
}

-keepclasseswithmembernames class * {
    native <methods>;
}

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

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream); …
Run Code Online (Sandbox Code Playgroud)

obfuscation logging android proguard

23
推荐指数
4
解决办法
2万
查看次数

Log.isLoggable是否返回错误的值?

当我为我的android应用程序编写日志包装器时,我注意到了一个奇怪的机器人Log.isLoggable方法.执行以下代码:

final String TAG = "Test";
Log.v(TAG, "verbose is active: " + Log.isLoggable(TAG, Log.VERBOSE));
Log.d(TAG, "debug is active: " + Log.isLoggable(TAG, Log.DEBUG));
Log.i(TAG, "info is active: " + Log.isLoggable(TAG, Log.INFO));
Log.w(TAG, "warn is active: " + Log.isLoggable(TAG, Log.WARN));
Log.e(TAG, "error is active: " + Log.isLoggable(TAG, Log.ERROR));
Run Code Online (Sandbox Code Playgroud)

生成以下LogCat输出:

VERBOSE/Test(598): verbose is active: false
DEBUG/Test(598): debug is active: false
INFO/Test(598): info is active: true
WARN/Test(598): warn is active: true
ERROR/Test(598): error is active: true
Run Code Online (Sandbox Code Playgroud)

虽然我使用详细和调试日志记录生成这些输出,但为什么我会得到详细信息并且调试未激活?

logging android android-emulator logcat

14
推荐指数
2
解决办法
7990
查看次数