Android ProGuard: can't find referenced class
Solution 1
This is the most common error beacuse of "many pre-compiled third-party libraries refer to other libraries that are not actually used and therefore not present. This works fine in debug builds, but in release builds, ProGuard expects all libraries, so it can perform a proper static analysis."
From: http://proguard.sourceforge.net/index.html#manual/examples.html
So,this javax.annotation.Nullable
might not be there in your project but the libraries you are using has some classes who are internally referring to them.
However you can avoid these warnings by -dontwarn javax.annotation.**
or --dontwarn com.google.common.collect.**
. But I dont think -keep class javax.annotation.** { *; }
and looks illogical.
So, if you do -keep class com.google.common.collect.** { *; }
you skip this package from all 3 steps of Proguard
execution (Shrinking,optimization and obfuscation) which makes sense according to my understanding.
Solution 2
Don't forget to add package
-keep class com.package_name.** { *; }
confile
Java, GWT, JavaScript, Grails, Groovy, Swift, Objective-C, iOS
Updated on June 24, 2022Comments
-
confile almost 2 years
Running ProGuard in my Android Studio Project I get warnings like this:
Warning: com.google.common.collect.Maps: can't find referenced class javax.annotation.Nullable
I might solve this with one of this variants:
1
-keep class com.google.common.collect.** { *; } -dontwarn com.google.common.collect.**
2
-keep class javax.annotation.** { *; } -dontwarn javax.annotation.**
What is the best way to solve the above warning? What is the difference between variant 1. and 2.?