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.

Update ProGuard rules for Toothpick 3.0 and KTP

See original GitHub issue

Hi, I’m migrating from TP 2.1.0 to TP 3.0 and I’ve noticed that some ProGuard rules need updating if you’re using @InjectConstructor and KTP delegates instead of @Inject-annotated properties. I didn’t find any info about this in the documentation so I’m posting it here.

The following seems to be working for me:

-keepnames @toothpick.InjectConstructor class *
-keepclasseswithmembernames class * { toothpick.ktp.delegate.* *; }
-keepclassmembers class * {
    toothpick.ktp.delegate.* *;
}

in addition to already defined rules. Note: I’m using that on top of the rules mentioned in #330

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
RumataEstorishcommented, Aug 13, 2021

When migrating to gradle plugin 7.0 had to add -keep @javax.inject.Qualifier public class * to keep qualifiers working

2reactions
dimsuzcommented, Sep 24, 2019

By the way, are there any plans to put proguard rules inside the library jar’s resources? Android’s new shrinker R8 (now default) supports this, so even clients who do not use smoothie will receive them, no need for manual addition and supporting wiki page. Moshi, okhttp, retrofit use this feature, it’s working great.

Maybe I’ll create a PR one day, but currently rather busy, so at least keep this in mind, iirc this isn’t a complex thing to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recently Active 'toothpick-di' Questions - Stack Overflow
Toothpick is working great for us on Android, but the required proguard / R8 rules mean that classes using injection cannot be obfuscated...
Read more >
Shrink, obfuscate, and optimize your app - Android Developers
R8 uses ProGuard rules files to modify its default behavior and better understand your app's structure, such as the classes that serve as...
Read more >
ProGuard Manual: Upgrading - Guardsquare
This page guides you in upgrading to the AGP 7 compatible ProGuard Gradle Plugin allowing you to continue using ProGuard to optimize, shrink...
Read more >
A scope tree based Dependency Injection (DI) library for Java ...
Last update: Dec 1, 2022 ... -adaptclassstrings added to proguard rules ... In Toothpick 3.0.0 there's an issue where the generated __MemberInjector has...
Read more >
GITHUB_TOKEN env variable from SecretKeyRef not working
Update ProGuard rules for Toothpick 3.0 and KTP, 7, 2019-09-17, 2022-12-04. "Uninstall" button does not respect "locked", 0, 2022-09-01, 2022-11-12.
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