Proguard: Can't Find Referenced Class Com.Google.Android.Gms.R

Android ProGuard warning -- can't find referenced class com.zhihu.matisse.R$plurals

For release version of APK, it is highly recommended to set minifyEnabled be true, this is not only to minimise the final size of your apk, but also help obfuscate your sensitive packages/classes into some messy form of code so that it won't be reverse engineered easily.

According to your error messages below:

com.zhihu.matisse.internal.model.SelectedItemCollection: can't find
referenced class com.zhihu.matisse.R$plurals

Means you miss the R package references which usually is the resource class from the android aar library, i.e. the zhihu, check if you are including this lib properly.

Workaround for this problem is as below to find your own strings.xml and put below declaration to cheat proguard.

<plurals name="error_over_count">
<item quantity="one">You can only select one media file</item>
<item quantity="many">You can only select up to %1$d media files</item>
</plurals>

ss.com.bannerslider.adapters.SliderRecylcerViewAdapter: can't find
referenced method 'void
onBindImageSlideView(int,ss.com.bannerslider.viewholder.ImageSlideViewHolder)'
in program class ss.com.bannerslider.adapters.SliderAdapter

ss.com.bannerslider.adapters.SliderRecylcerViewAdapter: can't find
referenced field 'ss.com.bannerslider.SlideType CUSTOM' in program
class ss.com.bannerslider.SlideType

ss.com.bannerslider.adapters.SliderRecylcerViewAdapter$2: can't find
referenced field 'ss.com.bannerslider.SlideType CUSTOM' in program
class ss.com.bannerslider.SlideType there were 2 unresolved
references to classes or interfaces. there were 3 unresolved
references to program class members. Exception while processing
task java.io.IOException: Please correct the above warnings first.

Means you miss the onBindImageSlideView package references which usually is from other libraries, check if you are including that lib properly.

proguard hell - can't find referenced class

This error occurs because the libs you use depend on other libs which are not realy used, but Proguard is looking for them.

Add your -dontwarn lines to your proguard-rules.pro file in your Android project to disable this warnings.

enter image description here

You can find which dependencies you need to add to your proguard-rules.pro in the stacktrace of your error.

Proguard returned with error code 1. (com.google.android.gms)

Try to prevent play services to obfuscate form proguard.

-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**

Android Proguard Can't find referenced

There are two problematic libraries:

RoundCornerProgressBar

MPAndroidChart

The first problem is with the class com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar. There is a solution here that overcomes the problem, by adding to Proguard:

-dontwarn com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar

The second one is simply solved by adding two statements to Proguard that the author of the library clearly describes here:

-keep class com.github.mikephil.charting.** { *; }
-dontwarn io.realm.**

Your Proguard file should contain those lines and the problems should disappear.



Related Topics



Leave a reply



Submit