Update ProGuard rules for Toothpick 3.0 and KTP
See original GitHub issueHi,
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:
- Created 4 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When migrating to gradle plugin 7.0 had to add -keep @javax.inject.Qualifier public class * to keep qualifiers working
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.