Apktool icon indicating copy to clipboard operation
Apktool copied to clipboard

feat: support aapt optimization

Open zjns opened this issue 10 months ago • 6 comments

These options help reduce the apk size when using aapt2, and --collapse-resource-names may have side effects.

zjns avatar Mar 30 '24 14:03 zjns

At the moment, I don't really see a need for this. Apktool challenge is reading and understanding these sparse/collapsed applications. I don't understand a use-case where users would be disassembling and reassembling an application with intention to sparse/chunk/collapse.

I'd be interested in hearing what is leading you to this need.

iBotPeaches avatar Mar 30 '24 23:03 iBotPeaches

Basically, most apps now perform the --shorten-resources-names optimization when they are compiled. It's default behavior when shrinkResouces flag enabled. When the app is large, shortening the resource path name can indeed reduce the size of the apk. As for the other two flags, there is really no need for them.

zjns avatar Mar 31 '24 02:03 zjns

I'm more worried about the flag in general when used with Apktool. This optimize feature works very well at stripping things that Apktool has to piece back together. Its a challenge in of itself to just disassemble and reassemble after an optimize command.

For this to go into the core - we'd need a few tests and samples to ensure a few things

  • basic build -> optimize
  • optimized build -> optimize

iBotPeaches avatar Mar 31 '24 10:03 iBotPeaches

@iBotPeaches seems out of context question but can the build time be reduced for recompile? one Settings app take around 25min to compile on my Ryzen 7 4700U laptop with 40GB ram,

its due to languages addition done in app but is there a way can this be reduced? without those additional languages, it repack same apk in less than 4mins

HassanMirza01 avatar Jul 16 '24 08:07 HassanMirza01

@iBotPeaches seems out of context question but can the build time be reduced for recompile? one Settings app take around 25min to compile on my Ryzen 7 4700U laptop with 40GB ram,

2.10.x has performance improvements to add parallelization.

iBotPeaches avatar Jul 16 '24 11:07 iBotPeaches

@iBotPeaches seems out of context question but can the build time be reduced for recompile? one Settings app take around 25min to compile on my Ryzen 7 4700U laptop with 40GB ram,

2.10.x has performance improvements to add parallelization.

i am always using latest compile binary with latest commits

HassanMirza01 avatar Jul 16 '24 13:07 HassanMirza01