Reputation: 7672
I have an anonymous class which implements an interface from another jar file (which is passed in as library jar).
//Some jar file
public interface B
{
void methodA();
}
//My App
public class A implements B
{
public void methodA()
{
//implementation here
}
}
And its used in the app in the following manner:
B var = new A();
var.methodA();
After running into a bug (calling abstract method), I noticed ProGuard had renamed methodA()
in class A
. Note that there may be more instances of such wrong obfuscations.
EDIT:
This is how I specify my library jars:
<libraryjar filter="!**\some.specific.jar,${base.dir}\dist\lib\*.jar" />
also tried:
<libraryjar jarfilter="!**\some.specific.jar" />
<libraryjar jarfilter="${base.dir}\dist\lib\*.jar" />
Neither worked. ProGuard doesn't read the library jars specified by the filter. It only reads the ones named explicitly.
Upvotes: 1
Views: 2736
Reputation: 45676
ProGuard doesn't rename program methods that implement or override library methods -- hardly any processed application would work otherwise. You should double-check that your configuration really specifies the proper input jars and library jars. ProGuard may already be printing out warnings if something doesn't seem consistent.
Upvotes: 1
Reputation: 2145
To keep classes implementing interface B, just add something like this to your proguard configuration file:
-keep class ** implements B {
*;
}
However, I notice that class A does not implement B correctly. The correct code for implementing B is
public class A implements B
{
// note the public modifier
public void methodA()
{
//implementation here
}
}
That is why proguard renamed the method.
Upvotes: 1