question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TickTock not works with R8 minifyEnabled true

See original GitHub issue

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?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ZacSweerscommented, Dec 27, 2020

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

0reactions
ZacSweerscommented, Nov 8, 2021

Nothing to do here, proguard configuration per app needs to be handled per app

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does 'minifyEnabled=true' do when all configuration ...
Everything is working fine except if I enable minification in my app/build.gradle via minifyEnabled true the app instantly crashes on startup ...
Read more >
TikTok Not Working? 7 Ways to Troubleshoot - Business Insider
If TikTok isn't working, there are many potential causes and solutions. The most common step is to restart the app or your phone....
Read more >
Developing Secure Android Apps. - ProAndroidDev
1- Never ship a production app without enabling Proguard/R8 ... But let's be real here it's not just these three lines to make...
Read more >
Hello World, meet our new experimental toolchain, Jack and Jill
We've been working on a new toolchain for Android that's designed to improve build times and simplify development by reducing dependencies on ...
Read more >
Android Quickstart - TikTok for Developers
Below is a quick start for you to apply the TikTok SDK to your application. You should confirm that your project has a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found