无法在启用proguard的情况下构建发布版本

时间:2016-07-28 07:24:21

标签: android android-studio proguard android-proguard butterknife

在调试模式下,一切运行正常。当生成带有minify的签名APK时,生成的apk不会生成。这是错误日志和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$1: 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

她是我的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>; }
-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'

2 个答案:

答案 0 :(得分:1)

-dontwarn butterknife.internal。**根据this

保存

-dontwarn retrofit。**根据this

保存

答案 1 :(得分:1)

对于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

对于其他proguard规则代码段,您可以访问android-proguard-snippets以获取更多信息。

建议: 您也可以将它们存储在一个单独的目录中,并将它们全部包含在内,而不是手动声明每个配置文件:

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

更多android-proguard-snippets