Security [SOLVED]: why proguard is only obfuscating the class which is not extending anything

Security [SOLVED]: why proguard is only obfuscating the class which is not extending anything

Home Forums Security Security [SOLVED]: why proguard is only obfuscating the class which is not extending anything

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36740

    Anonymous

    QuestionQuestion

    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.

    Here is my gradle file code:-

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

    and in my proguard rules.pro file

    -ignorewarnings
    

    please help me with this
    Thanks:)

    #36741

    Anonymous

    Accepted AnswerAnswer

    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(...);
    }
    

    For More Information you can visit Proguard official site

    Source: https://stackoverflow.com/questions/47941251/why-proguard-is-only-obfuscating-the-class-which-is-not-extending-anything
    Author: Pritesh – ????p?? ?s?????
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.