为什么proguard只会混淆那些没有扩展任何内容的类 [英] why proguard is only obfuscating the class which is not extending anything

查看:86
本文介绍了为什么proguard只会混淆那些没有扩展任何内容的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用proguard混淆我的android应用程序.但问题是当我反编译apk时,它仅显示更改的变量名称,但类名称与源中的名称相同.仅更改了一个类的名称,而没有扩展任何其他类.我搜索了许多选项,但没有任何用处我在这里发布我的问题.

i am trying to obfuscate my android application with proguard. But the problem is when i decompiled the apk it only shows the changed variable names but class names are same as in the source.Only one class's name is changed which is not extending the any other class.I have searched many options but nothing worked so i am posting my problem here.

这是我的gradle文件代码:-

Here is my gradle file code:-

 buildTypes {
    release {

        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
    }
}

以及在我的proguard rules.pro文件中

and in my proguard rules.pro file

-ignorewarnings

请帮助我 谢谢:)

推荐答案

我不知道您的情况到底是什么问题,但是我已经通过 proguard rules 下面的方法解决了我的问题,并且它们各不相同帮助您保护应用程序的规则

I don't know what exactly problem in your case but i had solved my problem by below proguard rules and their are various rules which help you to protect your application

-dontskipnonpubliclibraryclassmembers
-dontshrink
-dontoptimize
-printmapping build/libs/output/obfuscation.map
-keepattributes
-adaptclassstrings
-dontnote
-dontwarn

# Keep Android classes
-keep class ** extends android.** {
    <fields>;
    <methods>;
}

# Keep serializable classes & fields
-keep class ** extends java.io.Serializable {
    <fields>;
}

# Keep - Applications. Keep all application classes, along with their 'main'
# methods.
-keepclasseswithmembers public class * {
    public static void main(java.lang.String[]);
}

# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum  * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}


-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** e(...);
    public static *** w(...);
}

有关更多信息,您可以访问 Proguard official site

For More Information you can visit Proguard official site

这篇关于为什么proguard只会混淆那些没有扩展任何内容的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆