java - How to retain jar dependencies after obfuscating with ProGuard -


i have collection of jar files dependencies in diamond pattern:

          base.jar
         /          \
dep1.jar     dep2.jar
         \          /
         dep3.jar

i obfuscate them proguard retain dependencies, that, example, obfuscated versions of base.jar , dep2.jar can execute in isolation, without obfuscated versions of dep1.jar , dep3.jar (just can, unobfuscated). there classes distributed among jars same package names, , methods in dependent jars call methods (in various classes) that want obfuscated, in jars depend on.

when try obfuscate jars @ once, proguard doesn't "understand" dependencies; , takes static method class in base.jar , moves obfuscated class in dep1.jar. code in obfuscated version of dep2.jar "expects" method in base.jar, fails @ runtime if dep1.jar not on classpath.

how can insure dependencies in obfuscated jars retained?

the documentation suggests using incremental obfuscation -applymapping switch seems require can take one argument telling dependent methods obfuscated names use in calling the jars depend on, obfuscated first. obfuscation of dep1.jar can produce 1 such mapping file argument, , of dep2.jar can produce obfuscation of dep3.jar needs both of mapping files (plus of base.jar?) in -applymapping argument. dep1.jar , dep2.jar cannot obfuscated (or can they?), however, produce single mapping file, because code might relocated 1 other. must merge mapping files myself?

the easiest (albeit sub-optimal) solution process them @ once, without optimization (-dontoptimize).


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -