ticktock: TickTock not works with R8 minifyEnabled true

Hi!

I faced with a problem when build my app with minifyEnabled true. After analyzing apk I found that R8 delete all ticktock classes except AndroidTzdbRulesInitializer.

I found ticktock-runtime.pro in sources of ticktock-runtime, but rule that specified there seems to be not valid: -keep dev.zacsweers.ticktock.runtime.TickTockZoneRulesProvider

There should be something like this: -keep class dev.zacsweers.ticktock.runtime.TickTockZoneRulesProvider { *; }

I add that line to my proguard-rules.pro, but app crashes anyway.

It crashes on that line with exception java.lang.NoSuchMethodException: j$.time.zone.ZoneRules.<init>

I analyze intermediate desugar_lib_dex that L8 generates for desugaring classes and j$.time.zone.ZoneRules present there and in desugar_lib_project_keep_rules rules there is line -keep class j$.time.zone.ZoneRules, but as I understand this will not keep all class members, it should be -keep class j$.time.zone.ZoneRules { *; }.

So it seems to be a bug in L8 mechanism of minifying of desugaring classes.

I try to add -keep class j$.time.zone.ZoneRules { *; } to my proguard-rules.pro but there is no effect. I try to add -keep class java.time.zone.ZoneRules { *; } to my proguard-rules.pro but there is also no effect. I think there is because “L8 shrinks this dex file in isolation using the provided rules to produce the final, second dex file.” as Jake Wharton pointed in his article.

Which workaround we can apply to make ticktock work with R8 minify?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

This looks like an issue with our proguard rule due to wrong syntax, will fix