1

I'm using Zelix Klass Master to obfuscate my android apps. Been using It for about 1 year. I decided to upgrade my android studio since I was still running version 3.0.1. After updating android studio I can no longer obfuscate my apk with Zelix, It's using Proguard to obfuscate my android application the way Zelix works via proguard is that I need to replace the proguard jar inside the directory

<Android Studio>\gradle\m2repository\net\sf\proguard\proguard-base

I have replaced all the proguard jars in the directory and even delated the proguard parent file inside sf and it still uses proguard to obfuscate my android apk my guess is it no longer uses proguard from <Android Studio>\gradle\m2repository\net\sf\proguard because I deleted that directory and android studio still builds using proguard.

So the question is where is the new proguard lib? and how do I get it to use proguard from that directory (proguard-base) instead? for information about how to setup Zelix you can read it here:

Edit: After Svet's answer I tried doing what he suggested and it's throwing this error now..

Unable to find method 'proguard.KeepClassSpecification.(ZZZZZZZLproguard/ClassSpecification;Lproguard/ClassSpecification;)V'. Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
SamHoque
  • 2,978
  • 2
  • 13
  • 43
  • Do you run windows or mac? – Pierre Dec 12 '18 at 05:03
  • @Pierre Windows 10, 64 Bit. – SamHoque Dec 12 '18 at 05:04
  • In Android Studio, `File > Settings > Appearance & Behavior > System Settings > Android SDK > Android SDK Location` in that location, in `tools > proguard > lib` place the `ZKM.jar` file, and in `tools > proguard > bin` edit the `proguard.bat` file, change the file name for proguard to `java -jar "%PROGUARD_HOME%"\lib\ZKM.jar %*` – Pierre Dec 12 '18 at 05:45
  • when looking at what all is not supported, better just use `.pro` files. else I'd suggest to simply contact them: https://www.zelix.com/klassmaster/support.html ... https://meta.stackoverflow.com/questions/255745/why-were-not-customer-support-for-your-favorite-company – Martin Zeitler Dec 12 '18 at 22:34
  • @SamzSakerz native assembly also adds timely effort to reverse engineering: https://stackoverflow.com/questions/13351787/android-jni-string-encryption-decryption – Martin Zeitler Dec 13 '18 at 01:51
  • @SamzSakerz this is most likely no "obfuscation", but simple bit-shifting, which can be reversed just as simple: https://stackoverflow.com/questions/141525/what-are-bitwise-shift-bit-shift-operators-and-how-do-they-work – Martin Zeitler Dec 13 '18 at 02:15

3 Answers3

1

The problem appears to be the fact that ProGuard is now treated as a dependency of the Android Gradle plugin in the latest versions of Android Studio and so is updated along with it. So any replacement of the proguard.jar with the renamed proGuardStub.jar may being automatically reversed.

I am definitely not a Gradle expert. However, I am told that a change to the build.gradle like the following works.

buildscript {  
    repositories {
        flatDir { dirs '/proguard' }
    }
    dependencies {
        classpath ':proguard:'
    }
}

The "flatDir" specifies a flat directory repository which I believe will not be automatically updated. If there are any Gradle experts out there who can improve or elaborate on this approach then it would be greatly appreciated.

Svet
  • 131
  • 1
  • @SamzSakerz `ProGuard is now treated as a dependency of the Android Gradle plugin ... is updated... may... automatically reversed` was exactly my thoughts – Pierre Dec 13 '18 at 06:02
  • Hi, I have rewarded you the bounty because you helped me fix it, I have updated the proguardStub.jar to work with proguard 6.0.3 if you want to use it for Zelix you can, It can be found on my answer! :) Thanks again – SamHoque Dec 13 '18 at 08:28
1

Okay, I have fixed the issue thanks to Svet. I will reward him the bounty for helping me. So He answered and told me I had to change the proguard classPath like the following

buildscript {  
    repositories {
        flatDir { dirs '/proguard' }
    }
    dependencies {
        classpath ':proguard:'
    }
}

After that obviously It won't work with the original proguardStub.jar since It's for proguard 5.0 and not 6.0.3 I am taken the code apart and injected code into the old proguardStub.jar to be treated as 6.0.3 and now it finally works! here is the updated proguardStub.jar that I have created here.

If any of you are wondering how I did it, I just changed the bytecode using ASM so it doesn't cause errors and also changed the old String so it shows 6.0.3 instead of 5.0 :) Of course the String doesn't effect anything rather then just showing what version it is.

SamHoque
  • 2,978
  • 2
  • 13
  • 43
0

The fact that you are getting the "Unable to find method 'proguard.KeepClassSpecification.(ZZZZZZZLproguard/ClassSpecification;Lproguard/ClassSpecification;)V" error suggests that you are successfully using the renamed proguardStub.jar. The problem is that the current proguardStub.jar needs to be updated to more fully reflect ProGuard 6.0. It looks like ProGuard 6.0 adds an extra constructor which does not appear in the KeepClassSpecification class in proguardStub.jar.

You could reasonably expect a new release of proguardStub.jar in the next week or so.

Svet
  • 131
  • 1
  • @SamzSakerz You should probably downgrade not only `android studio`, but `android SDKmanager`, use older `build tools`, everything should be downgraded, rolled back. Or contact Zelix so they can update their solution to fit in with the new. – Pierre Dec 13 '18 at 06:05
  • Looking at his activity, you are right @SamzSakerz :) – Pierre Dec 13 '18 at 06:49