Proguard Rules for Android
See original GitHub issueHi!
Thanks for the project, it’s amazing!
Nevertheless, whenever I try to use it in an Android project that also uses Proguard, the compiler says that some classes could not be found:
Warning:org.cache2k.core.util.Log: can't find referenced class org.slf4j.LoggerFactory
Warning:org.cache2k.core.util.Log: can't find referenced class org.slf4j.helpers.NOPLoggerFactory
Warning:org.cache2k.core.util.Log: can't find referenced class org.slf4j.LoggerFactory
Warning:org.cache2k.core.util.Log: can't find referenced class org.slf4j.ILoggerFactory
Warning:org.cache2k.core.util.Log$1: can't find referenced class org.slf4j.ILoggerFactory
Warning:org.cache2k.core.util.Log$Slf4jLogger: can't find referenced class org.slf4j.Logger
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ManagementFactory
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ThreadMXBean
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ThreadInfo
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ThreadMXBean
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ThreadInfo
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ManagementFactory
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ThreadMXBean
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ThreadInfo
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ThreadMXBean
Warning:org.cache2k.core.util.ThreadDump: can't find referenced class java.lang.management.ThreadInfo
I have tried to add the following rules to avoid it:
-keep public class org.cache2k.core.util.**
-dontwarn org.slf4j**
-dontwarn java.lang.management**
But as soon as I launch the app with the rules, It crash because it can’t find some methods (they are obfuscated so it won’t call them)
What are the rules that must be used??
Thanks in advice!
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
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 >Configuring ProGuard | CodePath Android Cliffnotes
ProGuard is a tool to help minify, obfuscate, and optimize your code. It is not only especially useful for reducing the overall size...
Read more >Practical ProGuard rules examples | by Wojtek Kaliciński
Android's default ProGuard files (you should always include them, they have some really useful rules) already contain a rule for methods that ...
Read more >ProGuard in Android - GeeksforGeeks
It shrinks the application's size. · It removes unused classes and methods that contribute to an Android application's 64K method count limit.
Read more >ProGuard Manual: Usage - Guardsquare
For example, you can optimize your app for given Android SDK versions by specifying the supported range in the version constant. ProGuard can...
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
There is a new release (1.1.1.Alpha) which comes with an example of ProGuard rules. The description is here: https://cache2k.org/docs/latest/user-guide.html#android The JUnit test is is in the module: https://github.com/cache2k/cache2k/tree/master/test-android-proguard
The versions 1.1.x are intended for development and to stabilize the new features. I plan to release 1.2 in a couple of weeks.
That’s what I’m currently investigating, but for the moment I haven’t seen anything about “Avoid optimization for a specific class”