gr8 icon indicating copy to clipboard operation
gr8 copied to clipboard

Relocate without shrinkning

Open vlsi opened this issue 3 years ago • 4 comments

Hi,

I want to relocate AWS SDK for https://github.com/burrunan/gradle-s3-build-cache, and it looks like proguard is either "relocate+obfuscate" or "just keep old package names".

What I want is to just relocate packages under com.github.burrunan.s3cache.relocated package, and I don't want all the classes to be renamed as a.class so the stacktraces are understandable.

Do you know if there's a proguard configuration for that?

It looks like -keep would keep the original names (which would defeat the purpose of shading as it would conflict with other dependencies), however, -flattenpackagehierarchy and -repackageclasses obfuscate the names.

vlsi avatar Aug 05 '22 09:08 vlsi

You might want to try -dontshrink. @hvisser has had some success with that recently.

martinbonnin avatar Aug 05 '22 09:08 martinbonnin

Actually looks like -dontobfuscate might be a better bet according to this SO question.

Edit: nope doesn't seem to work either... I'll ask. Edit2: doesn't look like it's possible :/ https://issuetracker.google.com/issues/182543183

martinbonnin avatar Aug 05 '22 09:08 martinbonnin

-dontobfuscate keeps the original package names, so it does not really help :-/

software/amazon/awssdk/...
org/apache/http/..

vlsi avatar Aug 05 '22 09:08 vlsi

Turns out it just landed in R8 main: https://r8.googlesource.com/r8/+/81ae5c8b3ef02120cea8ac15bfc0f71aac66f72f

I'll give it a shot this week end.

martinbonnin avatar Aug 05 '22 15:08 martinbonnin

Turns out this is working since version 0.6 that uses R8 3.4 sorry I forgot to update this issue. To use it use -dontobfuscate together with -repackageclasses

-dontobfuscate
-repackageclasses com.example.relocated

martinbonnin avatar Apr 03 '23 20:04 martinbonnin