Determine if you are running at runtime?

Is there any way to detect (at runtime) if your application is ProGuarded? My goal here is to set a boolean based on whether the application is ProGuarded or not.

+4
source share
2 answers

I think it would be easier if you set the boolean in the build options / options that you run ProGuard on.

For example: if you started ProGuard on Release and Staging , but not Debugging , set the boolean variable to true when releasing and setting, but false when debugging. This can help

+3

, , .

, / proguard. , com.package.Thing, , proguard , minified com.package.a ( - , ). , , .

- :

boolean isProguardEnabled() {
    try{
        return Class.forName("com.package.Thing") == null;
    catch(ClassNotFoundException cnfe) {
        return true;
    }
}

, , , proguard.

, , com.package.a , ProGuard , , , a. ProGuard , , Proguard ( , ).

+2

All Articles