Package protected method call is not obfuscated accordingly

Hello everyone!

We are facing the issue, that a package protected method call from another project is not updated according to the obfuscation done by proguard.
To be precise, here an example:

We have two maven projects. Project A and Project B.

Maven Project A:

Contains the class “ProguardTest1”:

package com.example.proguard;

public class ProguardTest1 {

   public static void printHelloWorld() {
       System.out.println("Hello World!");
   }
   
   // Proguard rename this method to "a"
   static void printHelloProguard() {
       System.out.println("Hello Proguard!");
   }
}

Maven Project B:

Has Project A as a dependency and contains the following class “ProguardTest2”:

package com.example.proguard;

import com.example.proguard.ProguardTest1;

public class ProguardTest2 {

   public void printBoth() {
       ProguardTest1.printHelloWorld();
       // Expected: Proguard rename this method call also to "a"
       // Actual: Proguard does not rename this method call
       ProguardTest1.printHelloProguard();
   }

}

As mentioned in the code comments, we would expect, that proguard renames the method call in project B from “ProguardTest1.printHelloProguard()” to “ProguardTest1.a()”. Unfortunately it does not.
Side node: Renaming class names, updating imports and variables works perfectly fine across projects for us.
It just seems to have issues with package protected method calls from another project.

I have also added the jar from project A via option “-libraryjars” to the proguard execution for project B → without success.

Is someone facing the same issue? Or does someone have an idea how this issue can be solved?

I’ve found the solution. I just have to add the jar from project A via option “-injar” to the proguard execution for project B.

1 Like