混淆时的Butterknife编译错误

时间:2016-08-22 10:14:37

标签: android proguard android-proguard butterknife

我试图用proguard混淆我的应用程序,但是proguard正在抱怨butterknife接口/类无法找到。

错误日志:

Warning:com.example.app.view.fragments.startworkorder.LogFragment$$ViewBinder: can't find referenced class butterknife.ButterKnife$ViewBinder
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.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: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
Note: okhttp3.internal.platform.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
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 'com.codetroopers.betterpickers.R$attr { int icon; }'
      Maybe this is program field 'com.codetroopers.betterpickers.R$id { int 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.jakewharton.rxbinding.support.v7.appcompat.R$attr { int icon; }'
      Maybe this is program field 'com.jakewharton.rxbinding.support.v7.appcompat.R$id { int icon; }'
      Maybe this is program field 'com.example.app.R$attr { int icon; }'
      Maybe this is program field 'com.example.app.R$id { int icon; }'
      Maybe this is program field 'io.fabric.sdk.android.services.settings.AppRequestData { io.fabric.sdk.android.services.settings.IconRequest icon; }'
      Maybe this is program field 'io.fabric.sdk.android.services.settings.AppSettingsData { io.fabric.sdk.android.services.settings.AppIconSettingsData icon; }'
      Maybe this is program field 'uk.co.chrisjenx.calligraphy.R$attr { int icon; }'
      Maybe this is program field 'uk.co.chrisjenx.calligraphy.R$id { int 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 'com.codetroopers.betterpickers.R$attr { int title; }'
      Maybe this is program field 'com.codetroopers.betterpickers.R$id { int 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.jakewharton.rxbinding.support.v7.appcompat.R$attr { int title; }'
      Maybe this is program field 'com.jakewharton.rxbinding.support.v7.appcompat.R$id { int title; }'
      Maybe this is program field 'com.example.app.R$attr { int title; }'
      Maybe this is program field 'com.example.app.R$id { int title; }'
      Maybe this is program field 'com.example.app.jobs.FeedbackJob { java.lang.String title; }'
      Maybe this is program field 'com.example.app.view.adapters.TasksAdapter$TaskViewHolder { android.widget.TextView title; }'
      Maybe this is program field 'io.fabric.sdk.android.services.settings.PromptSettingsData { java.lang.String title; }'
      Maybe this is program field 'uk.co.chrisjenx.calligraphy.R$attr { int title; }'
      Maybe this is program field 'uk.co.chrisjenx.calligraphy.R$id { int 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: android.support.v4.app.NotificationManagerCompatKitKat accesses a declared field 'OP_POST_NOTIFICATION' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationManagerCompatKitKat { java.lang.String OP_POST_NOTIFICATION; }'
Note: com.codetroopers.betterpickers.timezonepicker.TimeZoneInfo accesses a declared field 'mTransitions' dynamically
      Maybe this is program field 'com.codetroopers.betterpickers.timezonepicker.TimeZoneInfo { long[] mTransitions; }'
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.flags.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.flags.ModuleDescriptor { int MODULE_VERSION; }'
Note: com.google.gson.internal.UnsafeAllocator accesses a declared field 'theUnsafe' dynamically
Note: rx.internal.util.PlatformDependent accesses a field 'SDK_INT' dynamically
      Maybe this is program field 'android.databinding.ViewDataBinding { int SDK_INT; }'
      Maybe this is library field 'android.os.Build$VERSION { int SDK_INT; }'
Note: the configuration keeps the entry point 'android.support.design.widget.NavigationView { void setNavigationItemSelectedListener(android.support.design.widget.NavigationView$OnNavigationItemSelectedListener); }', but not the descriptor class 'android.support.design.widget.NavigationView$OnNavigationItemSelectedListener'
Note: the configuration keeps the entry point 'android.support.design.widget.Snackbar$SnackbarLayout { void setOnLayoutChangeListener(android.support.design.widget.Snackbar$SnackbarLayout$OnLayoutChangeListener); }', but not the descriptor class 'android.support.design.widget.Snackbar$SnackbarLayout$OnLayoutChangeListener'
Note: the configuration keeps the entry point 'android.support.design.widget.Snackbar$SnackbarLayout { void setOnAttachStateChangeListener(android.support.design.widget.Snackbar$SnackbarLayout$OnAttachStateChangeListener); }', but not the descriptor class 'android.support.design.widget.Snackbar$SnackbarLayout$OnAttachStateChangeListener'
Note: the configuration keeps the entry point 'android.support.design.widget.TabLayout { void setOnTabSelectedListener(android.support.design.widget.TabLayout$OnTabSelectedListener); }', but not the descriptor class 'android.support.design.widget.TabLayout$OnTabSelectedListener'
Note: the configuration keeps the entry point 'android.support.design.widget.TabLayout { void setTabsFromPagerAdapter(android.support.v4.view.PagerAdapter); }', but not the descriptor class 'android.support.v4.view.PagerAdapter'
Note: the configuration keeps the entry point 'android.support.v4.view.ViewPager { void setAdapter(android.support.v4.view.PagerAdapter); }', but not the descriptor class 'android.support.v4.view.PagerAdapter'
Note: the configuration keeps the entry point 'android.support.v7.widget.Toolbar { void setOnMenuItemClickListener(android.support.v7.widget.Toolbar$OnMenuItemClickListener); }', but not the descriptor class 'android.support.v7.widget.Toolbar$OnMenuItemClickListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.ViewStubCompat { void setOnInflateListener(android.support.v7.widget.ViewStubCompat$OnInflateListener); }', but not the descriptor class 'android.support.v7.widget.ViewStubCompat$OnInflateListener'
Note: the configuration keeps the entry point 'com.codetroopers.betterpickers.calendardatepicker.DayPickerView { void setController(com.codetroopers.betterpickers.calendardatepicker.CalendarDatePickerController); }', but not the descriptor class 'com.codetroopers.betterpickers.calendardatepicker.CalendarDatePickerController'
Note: the configuration keeps the entry point 'com.codetroopers.betterpickers.calendardatepicker.MonthView { void setOnDayClickListener(com.codetroopers.betterpickers.calendardatepicker.MonthView$OnDayClickListener); }', but not the descriptor class 'com.codetroopers.betterpickers.calendardatepicker.MonthView$OnDayClickListener'
Note: the configuration keeps the entry point 'com.codetroopers.betterpickers.radialtimepicker.RadialPickerLayout { void setOnValueSelectedListener(com.codetroopers.betterpickers.radialtimepicker.RadialPickerLayout$OnValueSelectedListener); }', but not the descriptor class 'com.codetroopers.betterpickers.radialtimepicker.RadialPickerLayout$OnValueSelectedListener'
Note: the configuration keeps the entry point 'com.codetroopers.betterpickers.widget.UnderlinePageIndicatorPicker { void setOnPageChangeListener(android.support.v4.view.ViewPager$OnPageChangeListener); }', but not the descriptor class 'android.support.v4.view.ViewPager$OnPageChangeListener'
Note: the configuration keeps the entry point 'com.codetroopers.betterpickers.widget.UnderlinePageIndicatorPicker { void setTitleView(com.codetroopers.betterpickers.widget.PickerLinearLayout); }', but not the descriptor class 'com.codetroopers.betterpickers.widget.PickerLinearLayout'
Note: the configuration keeps the entry point 'com.github.clans.fab.FloatingActionMenu { void setLabelEllipsize(com.github.clans.fab.Label); }', but not the descriptor class 'com.github.clans.fab.Label'
Note: the configuration keeps the entry point 'com.github.clans.fab.FloatingActionMenu { void setOnMenuToggleListener(com.github.clans.fab.FloatingActionMenu$OnMenuToggleListener); }', but not the descriptor class 'com.github.clans.fab.FloatingActionMenu$OnMenuToggleListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.identifier.AdvertisingIdClient { com.google.android.gms.internal.zzbu zza(android.content.Context,com.google.android.gms.common.zza); }', but not the descriptor class 'com.google.android.gms.common.zza'
Note: the configuration keeps the entry point 'com.google.android.gms.common.GooglePlayServicesUtil { android.app.Dialog zza(int,android.app.Activity,com.google.android.gms.common.internal.zzi,android.content.DialogInterface$OnCancelListener); }', but not the descriptor class 'com.google.android.gms.common.internal.zzi'
Note: the configuration keeps the entry point 'com.google.android.gms.common.GooglePlayServicesUtil { boolean showErrorDialogFragment(int,android.app.Activity,android.support.v4.app.Fragment,int,android.content.DialogInterface$OnCancelListener); }', but not the descriptor class 'android.support.v4.app.Fragment'
Note: the configuration keeps the entry point 'com.google.firebase.iid.FirebaseInstanceId { com.google.firebase.iid.FirebaseInstanceId getInstance(com.google.firebase.FirebaseApp); }', but not the descriptor class 'com.google.firebase.FirebaseApp'
Note: the configuration keeps the entry point 'com.example.app.customviews.CirclePageIndicator { void setOnPageChangeListener(android.support.v4.view.ViewPager$OnPageChangeListener); }', but not the descriptor class 'android.support.v4.view.ViewPager$OnPageChangeListener'
Note: the configuration keeps the entry point 'com.example.app.customviews.ExpandableLayout { void setOnExpandListener(com.example.app.customviews.ExpandableLayout$OnExpandListener); }', but not the descriptor class 'com.example.app.customviews.ExpandableLayout$OnExpandListener'
Note: the configuration keeps the entry point 'com.example.app.customviews.signature.SignaturePad { void setOnSignedListener(com.example.app.customviews.signature.SignaturePad$OnSignedListener); }', but not the descriptor class 'com.example.app.customviews.signature.SignaturePad$OnSignedListener'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2$Writer { void data(boolean,int,okio.Buffer,int); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2$Writer { void dataFrame(int,byte,okio.Buffer,int); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.NameValueBlockReader { NameValueBlockReader(okio.BufferedSource); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.NameValueBlockReader$1 { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.PushObserver { boolean onData(int,okio.BufferedSource,int,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.PushObserver$1 { boolean onData(int,okio.BufferedSource,int,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3 { okhttp3.internal.framed.FrameReader newReader(okio.BufferedSource,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3 { okhttp3.internal.framed.FrameWriter newWriter(okio.BufferedSink,boolean); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3$Reader { Spdy3$Reader(okio.BufferedSource,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3$Writer { Spdy3$Writer(okio.BufferedSink,boolean); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3$Writer { void data(boolean,int,okio.Buffer,int); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3$Writer { void sendDataFrame(int,int,okio.Buffer,int); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Variant { okhttp3.internal.framed.FrameReader newReader(okio.BufferedSource,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Variant { okhttp3.internal.framed.FrameWriter newWriter(okio.BufferedSink,boolean); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream { Http1xStream(okhttp3.OkHttpClient,okhttp3.internal.connection.StreamAllocation,okio.BufferedSource,okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream { Http1xStream(okhttp3.OkHttpClient,okhttp3.internal.connection.StreamAllocation,okio.BufferedSource,okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream { void detachTimeout(okio.ForwardingTimeout); }', but not the descriptor class 'okio.ForwardingTimeout'
Note: the configuration keeps the entry point 'okhttp3.logging.HttpLoggingInterceptor { boolean isPlaintext(okio.Buffer); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okio.AsyncTimeout { void scheduleTimeout(okio.AsyncTimeout,long,boolean); }', but not the descriptor class 'okio.AsyncTimeout'
Note: the configuration keeps the entry point 'okio.AsyncTimeout { boolean cancelScheduledTimeout(okio.AsyncTimeout); }', but not the descriptor class 'okio.AsyncTimeout'
Note: the configuration keeps the entry point 'okio.AsyncTimeout { okio.Sink sink(okio.Sink); }', but not the descriptor class 'okio.Sink'
Note: the configuration keeps the entry point 'okio.AsyncTimeout { okio.Source source(okio.Source); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okio.ForwardingSink { ForwardingSink(okio.Sink); }', but not the descriptor class 'okio.Sink'
Note: the configuration keeps the entry point 'okio.ForwardingSink { void write(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okio.ForwardingSource { ForwardingSource(okio.Source); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okio.ForwardingSource { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: there were 3 references to unknown classes.
      You should check your configuration for typos.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
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 165 unkept descriptor classes in kept class members.
      You should consider explicitly keeping the mentioned classes
      (using '-keep').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 10 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 450 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:Exception while processing task java.io.IOException: Please correct the above warnings first.
:EAM360:transformClassesAndResourcesWithProguardForGshDebug FAILED
Error:Execution failed for task ':EAM360:transformClassesAndResourcesWithProguardForGshDebug'.
> java.io.IOException: Please correct the above warnings first.

尝试了以下proguard配置。

配置:1

# Butterknife Configurations
# 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>; }

配置2:

-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }

-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}

-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}

配置3:

-keep class butterknife.** {
  *;
}

我正在使用ButterKnife 8.2.1

请帮我找到合适的配置。

0 个答案:

没有答案
相关问题