Android ProGuard 警告 -- 找不到引用 class "com.zhihu.matisse.R$plurals"

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

设置 minifyEnabled 为真后无法生成签名的 APk。 当 set minifyEnabled enabled false.i 没有 problem.is 时,必须将 minifyEnabled 设置为 true 吗?没有有什么问题?

我的 ProGuard 规则在这里..

-dontwarn com.squareup.picasso.**
 -dontwarn com.squareup.okhttp.internal.**
 -dontwarn org.apache.commons.logging.**
 -dontwarn okhttp3.internal.platform.*
 -dontwarn java.lang.invoke.*
 -dontwarn com.bumptech.glide.**
 -dontwarn org.apache.http.**
 -dontwarn android.net.http.AndroidHttpClient
 -dontwarn com.google.android.gms.**
 -dontwarn com.android.volley.toolbox.**
 -dontwarn com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool
 -dontwarn com.bumptech.glide.load.resource.bitmap.Downsampler
 -dontwarn com.bumptech.glide.load.resource.bitmap.HardwareConfigState
 -dontwarn io.card.**

我收到了 7 条警告

com.zhihu.matisse.internal.model.SelectedItemCollection: can't find referenced class com.zhihu.matisse.R$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: 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.   

我的 gradle 个文件

  implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.google.code.gson:gson:2.8.1'
    implementation 'com.mindorks:placeholderview:0.7.2'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.github.rakshakhegde:stepper-indicator:2.0.0-alpha'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.basgeekball:awesome-validation:1.3'
    implementation 'com.github.f0ris.sweetalert:library:1.5.3'
    implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation 'com.daprlabs.aaron:cardstack:0.3.1-beta0'
    implementation 'com.customtoast:CustomToastLib:1.0.0'
    implementation 'com.ss.bannerslider:bannerslider:2.0.0'
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
    implementation 'net.steamcrafted:materialiconlib:1.1.5'
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    implementation 'co.lujun:androidtagview:1.1.4'
    implementation 'jp.wasabeef:glide-transformations:3.3.0'

    implementation 'org.apache.commons:commons-io:1.3.2'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.2'

    implementation 'com.google.firebase:firebase-messaging:17.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.github.armcha:SpaceNavigationView:1.6.0'
    implementation 'com.borax12.materialdaterangepicker:library:1.9'
    implementation 'com.appyvet:materialrangebar:1.4.3'
    implementation 'com.amitshekhar.android:android-networking:1.0.2'

    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-places:15.0.1'
    implementation 'com.zhihu.android:matisse:0.5.0-beta3'
    implementation 'com.intuit.sdp:sdp-android:1.0.5'
    implementation 'com.vanniktech:emoji-one:0.5.1'

请帮助我..我们将不胜感激...

对于release版本的APK,强烈建议将minifyEnabled设置为true,这样不仅可以最小化apk的最终大小,而且帮助 混淆 你的敏感 packages/classes 到一些混乱的代码形式,这样它就不会轻易被逆向工程。

根据您的以下错误信息:

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

意味着你错过了 R 包引用,它通常是 android aar 库中的资源 class,即 zhihu,检查你是否包括了这个lib 正确。

此问题的解决方法 如下找到您自己的 strings.xml 并在下方声明以欺骗 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: 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.

意味着您错过了通常来自其他库的 onBindImageSlideView 包引用,请检查您是否正确包含该库。