Disabling combining classes with the same classpath

I have two skins for my app is located in two jar, in both there is a class: ru.project.skin.SkinLoader. The name and path are the same, but the content is different. I run proguard by specifying in the config:

injars "../myApp.jar"
outjars "../proguard/myApp.jar"
injars "../skin-one.jar"
outjars "../proguard/skin-one.jar"
injars "../skin-two.jar"
outjars "../proguard/skin-two.jar"

The output is that the content of the SkinLoader class is the same for two jars and is taken from skin-one.jar, and the code from SkinLoader to skin-two.the jar is lost. How can I avoid this and save the class contents?

I tried to specify in the config:

-keep class ru.project.skin.**
-keepclassmembers class ru.project.skin.** {
    *;
}

But it didn’t help. I also read the documentation, but I didn’t find anything suitable.

Tried running with:

-dontshrink
-dontobfuscate
-dontoptimize

The code is still being erased.

Maybe I’m asking the wrong question? Can you tell me what the problem is?

Hi @article ,

Have you tried renaming the class - or change its path in one jar?

It seems troublesome that two classes would share the exact same path and name - but are expected to invoke different code blocks. It won’t know how to distinguish between the two identically named and located classes.

It seems this is most likely unrelated to ProGuard, you already enabled all (3) ‘-dont’ options which disabled ProGuard entirely. This would point back to my first tip, where I advise changing one of the class names and/or paths so it can be identified apart from the other one.

Please let me know if anything is not clear.

Kind Regards,

Jack

1 Like