无法在启用混淆器的情况下构建发布版本

Not able to build release build with proguard enabled

在调试模式下,一切都在运行 fine.When 生成签名的 APK 并启用 minify 作为真正的 apk 不是 generated.Here 的错误日志和 proguard 文件配置。 我的gradle版本是2.10,目标sdk版本是23.

Note: there were 7 duplicate class definitions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Initializing...
Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
'Field.getType'
Note: com.google.android.gms.internal.zzaix calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzaix calls 'Class.getTypeParameters'
Note: com.google.android.gms.internal.zzaix$zza calls 'Field.getGenericType'
Note: com.google.android.gms.internal.zzaix$zza calls 'Method.getGenericParameterTypes'
Note: com.google.android.gms.internal.zzaky calls 'Class.getGenericInterfaces'
Note: com.google.android.gms.internal.zzaky calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzaky calls 'Class.getTypeParameters'
Note: com.google.android.gms.internal.zzala calls 'Field.getType'
Note: com.google.android.gms.internal.zzalq calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzalq calls 'Field.getGenericType'
Note: com.google.android.gms.internal.zzalq calls 'Field.getType'
Note: com.google.android.gms.internal.zzalv calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzamk calls 'Field.getType'
Note: com.google.gson.FieldAttributes calls 'Field.getGenericType'
Note: com.google.gson.FieldAttributes calls 'Field.getType'
Note: com.google.gson.internal.$Gson$Types calls 'Class.getGenericInterfaces'
Note: com.google.gson.internal.$Gson$Types calls 'Class.getGenericSuperclass'
Note: com.google.gson.internal.$Gson$Types calls 'Class.getTypeParameters'
Note: com.google.gson.internal.Excluder calls 'Field.getType'
Note: com.google.gson.internal.bind.ReflectiveTypeAdapterFactory calls 'Field.getType'
Note: com.google.gson.internal.bind.ReflectiveTypeAdapterFactory calls 'Field.getGenericType'
Note: com.google.gson.internal.bind.ReflectiveTypeAdapterFactory calls 'Class.getGenericSuperclass'
Note: com.google.gson.reflect.TypeToken calls 'Class.getGenericSuperclass'
Note: com.google.gson.reflect.TypeToken calls 'Class.getTypeParameters'
Note: com.google.gson.reflect.TypeToken calls 'Class.getGenericInterfaces'
Note: retrofit.MethodHandler calls 'Method.getGenericReturnType'
Note: retrofit.RequestFactoryParser calls 'Method.getGenericParameterTypes'
Note: butterknife.internal.BindingClass calls 'Class.getEnclosingClass'
Note: com.google.android.gms.internal.zzaky$zzb calls 'Class.getEnclosingClass'
Note: com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl calls 'Class.getEnclosingClass'
Warning:butterknife.internal.ButterKnifeProcessor: can't find superclass or interface javax.annotation.processing.AbstractProcessor
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.AbstractProcessor
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.ProcessingEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.TypeKind
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.SourceVersion
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced field 'javax.annotation.processing.ProcessingEnvironment processingEnv' in program class butterknife.internal.ButterKnifeProcessor
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.ProcessingEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.tools.Diagnostic$Kind
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.Messager
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.util.Elements
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.PackageElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.AnnotationMirror
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.AbstractProcessor
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.RoundEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.TypeMirror
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.DeclaredType
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.ExecutableElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.VariableElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.ProcessingEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.Filer
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.tools.JavaFileObject
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.RoundEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Modifier
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.ElementKind
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.TypeKind
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.util.Types
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.util.Elements
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.util.Types
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.Filer
class javax.annotation.processing.RoundEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.RoundEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.RoundEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.RoundEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Modifier
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced 
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.TypeMirror
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.RoundEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.RoundEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.annotation.processing.RoundEnvironment
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.TypeVariable
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.VariableElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced 
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.TypeMirror
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.DeclaredType
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.TypeMirror
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.type.TypeMirror
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.SourceVersion
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.TypeElement
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.AnnotationMirror
Warning:butterknife.internal.ButterKnifeProcessor: can't find referenced class javax.lang.model.element.Element
Warning:retrofit.Platform$Java8: can't find referenced method 'boolean isDefault()' in library class java.lang.reflect.Method
Warning:retrofit.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles
Warning:retrofit.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup
Warning:retrofit.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle
Warning:retrofit.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles
Warning:retrofit.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup
Warning:retrofit.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle
Warning:retrofit.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21: can't find dynamically referenced class android.service.media.IMediaBrowserServiceCallbacks
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21: can't find dynamically referenced class android.content.pm.ParceledListSlice
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21$Stub: can't find dynamically referenced class android.service.media.IMediaBrowserServiceCallbacks$Stub
Note: android.support.v4.media.ParceledListSliceAdapterApi21: can't find dynamically referenced class android.content.pm.ParceledListSlice
Note: android.support.v4.text.ICUCompatApi23: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v7.widget.DrawableUtils: can't find dynamically referenced class android.graphics.Insets
Note: com.google.android.gms.internal.zzaey: can't find dynamically referenced class com.google.appengine.api.ThreadManager
Note: com.google.android.gms.internal.zzalh: can't find dynamically referenced class sun.misc.Unsafe
Note: com.google.android.gms.maps.internal.zzad: can't find dynamically referenced class com.google.android.gms.maps.internal.CreatorImpl
Note: com.google.gson.internal.UnsafeAllocator: can't find dynamically referenced class sun.misc.Unsafe
Note: com.onesignal.ActivityLifecycleListenerCompat: can't find dynamically referenced class android.app.ActivityThread
Note: com.onesignal.OSUtils: can't find dynamically referenced class com.amazon.device.messaging.ADM
Note: com.onesignal.OneSignal: can't find dynamically referenced class com.amazon.device.iap.PurchasingListener
Note: com.onesignal.TrackAmazonPurchase: can't find dynamically referenced class com.amazon.device.iap.internal.d
Note: com.onesignal.TrackGooglePurchase: can't find dynamically referenced class com.android.vending.billing.IInAppBillingService
Note: com.onesignal.TrackGooglePurchase: can't find dynamically referenced class com.android.vending.billing.IInAppBillingService$Stub
Note: com.onesignal.shortcutbadger.impl.XiaomiHomeBadger: can't find dynamically referenced class android.app.MiuiNotification
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class com.android.org.conscrypt.OpenSSLSocketImpl
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl
Note: retrofit.Platform: can't find dynamically referenced class java.util.Optional
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'icon' dynamically
      Maybe this is program field 'android.support.design.R$attr { int icon; }'
      Maybe this is program field 'android.support.design.R$id { int icon; }'
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { int icon; }'
      Maybe this is program field 'android.support.v7.appcompat.R$attr { int icon; }'
      Maybe this is program field 'android.support.v7.appcompat.R$id { int icon; }'
      Maybe this is program field 'android.support.v7.mediarouter.R$attr { int icon; }'
      Maybe this is program field 'android.support.v7.mediarouter.R$id { int icon; }'
      Maybe this is program field 'com.cameoapps.watchon.R$attr { int icon; }'
      Maybe this is program field 'com.cameoapps.watchon.R$id { int icon; }'
      Maybe this is program field 'com.cameoapps.watchon.rest.models.Event { java.lang.String icon; }'
      Maybe this is program field 'com.cameoapps.watchon.rest.models.Match { java.lang.String icon; }'
      Maybe this is program field 'com.cameoapps.watchon.rest.models.PlayersDetail { java.lang.String icon; }'
      Maybe this is program field 'com.cameoapps.watchon.rest.models.Sport { java.lang.String icon; }'
      Maybe this is program field 'com.cameoapps.watchon.rest.models.SportDetails { java.lang.String icon; }'
      Maybe this is program field 'com.cameoapps.watchon.rest.models.TeamsDetail { java.lang.String icon; }'
      Maybe this is program field 'com.cameoapps.watchon.rest.models.Tournament { java.lang.String icon; }'
      Maybe this is program field 'com.cameoapps.watchon.rest.models.TournamentDetails { java.lang.String icon; }'
      Maybe this is program field 'com.google.android.gms.R$attr { int icon; }'
      Maybe this is program field 'com.google.android.gms.R$id { int icon; }'
      Maybe this is program field 'com.onesignal.OSNotificationPayload$ActionButton { java.lang.String icon; }'
      Maybe this is library field 'android.R$attr { int icon; }'
      Maybe this is library field 'android.R$id { int icon; }'
      Maybe this is library field 'android.app.LauncherActivity$ListItem { android.graphics.drawable.Drawable icon; }'
      Maybe this is library field 'android.app.Notification { int icon; }'
      Maybe this is library field 'android.app.Notification$Action { int icon; }'
      Maybe this is library field 'android.appwidget.AppWidgetProviderInfo { int icon; }'
      Maybe this is library field 'android.content.pm.PackageItemInfo { int icon; }'
      Maybe this is library field 'android.content.pm.ResolveInfo { int icon; }'
      Maybe this is library field 'android.inputmethodservice.Keyboard$Key { android.graphics.drawable.Drawable icon; }'
      Maybe this is library field 'android.speech.tts.TextToSpeech$EngineInfo { int icon; }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'title' dynamically
      Maybe this is program field 'android.support.design.R$attr { int title; }'
      Maybe this is program field 'android.support.design.R$id { int title; }'
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { java.lang.CharSequence title; }'
      Maybe this is program field 'android.support.v7.appcompat.R$attr { int title; }'
      Maybe this is program field 'android.support.v7.appcompat.R$id { int title; }'
      Maybe this is program field 'android.support.v7.mediarouter.R$attr { int title; }'
      Maybe this is program field 'android.support.v7.mediarouter.R$id { int title; }'
      Maybe this is program field 'com.cameoapps.watchon.R$attr { int title; }'
      Maybe this is program field 'com.cameoapps.watchon.R$id { int title; }'
      Maybe this is program field 'com.cameoapps.watchon.activities.FilteredEventsActivity { java.lang.String title; }'
      Maybe this is program field 'com.cameoapps.watchon.rest.models.Match { java.lang.String title; }'
      Maybe this is program field 'com.google.android.gms.R$attr { int title; }'
      Maybe this is program field 'com.google.android.gms.R$id { int title; }'
      Maybe this is program field 'com.google.android.gms.games.internal.player.PlayerColumnNames { java.lang.String title; }'
      Maybe this is program field 'com.google.android.gms.vision.barcode.Barcode$ContactInfo { java.lang.String title; }'
      Maybe this is program field 'com.google.android.gms.vision.barcode.Barcode$UrlBookmark { java.lang.String title; }'
      Maybe this is program field 'com.onesignal.OSNotificationPayload { java.lang.String title; }'
      Maybe this is library field 'android.R$attr { int title; }'
      Maybe this is library field 'android.R$id { int title; }'
      Maybe this is library field 'android.app.Notification$Action { java.lang.CharSequence title; }'
      Maybe this is library field 'android.preference.PreferenceActivity$Header { java.lang.CharSequence title; }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'actionIntent' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { android.app.PendingIntent actionIntent; }'
      Maybe this is library field 'android.app.Notification$Action { android.app.PendingIntent actionIntent; }'
Note: com.google.android.gms.internal.zzalh accesses a declared field 'theUnsafe' dynamically
Note: com.google.android.gms.internal.zzqi accesses a declared field 'MODULE_ID' dynamically
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.ads.dynamite.ModuleDescriptor { java.lang.String MODULE_ID; }'
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.firebase_database.ModuleDescriptor { java.lang.String MODULE_ID; }'
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.flags.ModuleDescriptor { java.lang.String MODULE_ID; }'
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.tagmanager.ModuleDescriptor { java.lang.String MODULE_ID; }'
Note: com.google.android.gms.internal.zzqi accesses a declared field 'MODULE_VERSION' dynamically
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.ads.dynamite.ModuleDescriptor { int MODULE_VERSION; }'
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.firebase_database.ModuleDescriptor { int MODULE_VERSION; }'
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.flags.ModuleDescriptor { int MODULE_VERSION; }'
      Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.tagmanager.ModuleDescriptor { int MODULE_VERSION; }'
Note: com.google.gson.internal.UnsafeAllocator accesses a declared field 'theUnsafe' dynamically
Note: com.onesignal.ActivityLifecycleListenerCompat accesses a declared field 'mInstrumentation' dynamically
Note: com.onesignal.TrackAmazonPurchase accesses a declared field 'f' dynamically
Note: com.onesignal.shortcutbadger.impl.XiaomiHomeBadger accesses a declared field 'messageCount' dynamically
Note: there were 4 references to unknown classes.
      You should check your configuration for typos.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 28 classes trying to access generic signatures using reflection.
      You should consider keeping the signature attributes
      (using '-keepattributes Signature').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 3 classes trying to access enclosing classes using reflection.
      You should consider keeping the inner classes attributes
      (using '-keepattributes InnerClasses').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 21 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 10 accesses to class members by means of introspection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
Warning:there were 247 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 1 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning:there were 1 unresolved references to library class members.
         You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
Information:BUILD FAILED
Information:Total time: 18.303 secs
Information:1 error
Information:185 warnings

她的是我的混淆文件。

# Retain generated class which implement ViewBinder.
-keep public class * implements butterknife.internal.ViewBinder { public <init>(); }

# Prevent obfuscation of types which use ButterKnife annotations since the simple name
# is used to reflectively look up the generated ViewBinder.
-keep class butterknife.*
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
-keepclasseswithmembernames class * { @butterknife.* <fields>; }
-keep class **$$ViewBinder { *; }

-keepnames class * { @butterknife.Bind *;}

-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

这里是build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'




android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"


    dexOptions {
        javaMaxHeapSize "4g" //specify the heap size for the dex process
    }

    defaultConfig {
        applicationId "com.cameoapps.watchon"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true





        manifestPlaceholders = [manifestApplicationId          : "${applicationId}",
                                onesignal_app_id               : "6dasd33e-9c52-4f73-b6cb-3e41b129edbb",
                                onesignal_google_project_number: "22699sdfsdf03"]


    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }


    lintOptions {
        checkReleaseBuilds false
        disable 'InvalidPackage'
     abortOnError false
    }


}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    apt 'org.parceler:parceler:1.0.4'
    compile 'com.onesignal:OneSignal:2.+@aar'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile'com.android.support:design:23.3.0'
    compile'com.google.code.gson:gson:2.2.4'
    compile'com.squareup.retrofit:retrofit:2.0.0-beta2'
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'org.parceler:parceler-api:1.0.4'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile 'com.google.android.gms:play-services:9.0.2'
    compile 'com.google.firebase:firebase-ads:9.0.2'
    compile 'com.google.firebase:firebase-core:9.0.2'
}

apply plugin: 'com.google.gms.google-services'

-dontwarn butterknife.internal.** 根据this

保存

-dontwarn retrofit.** 根据this

保存

对于 ButterKnife proguard 规则使用:

# Retain generated class which implement ViewBinder.
-keep public class * implements butterknife.internal.ViewBinder { public <init>(); }

# Prevent obfuscation of types which use ButterKnife annotations since the simple name
# is used to reflectively look up the generated ViewBinder.
-keep class butterknife.*
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
-keepclasseswithmembernames class * { @butterknife.* <fields>; }

了解 ButterKnife rule issue for 7.0.1

对于其他混淆器规则片段,您可以访问android-proguard-snippets了解更多信息。

一个建议: 除了手动声明每个配置文件,您还可以将它们存储在单独的目录中并一次包含它们:

FileCollection proGuardFileCollection = files { file('./proguard').listFiles() }
proguardFiles(proGuardFileCollection)

更多信息在 android-proguard-snippets