如何使用 proguard 获取发布构建 apk 文件
Posted
技术标签:
【中文标题】如何使用 proguard 获取发布构建 apk 文件【英文标题】:How to get release build apk file using proguard 【发布时间】:2016-06-03 01:43:24 【问题描述】:我正在尝试使用 ProGuard 为我的项目制作发布 apk 文件,显然我正在使用许多第三方库,我只需要使用它们中的几个类,我真的很想得到一些关于这个的解释.
我的调试版本超过20-MB
,所以我想通过使用shrinking
中的shrinking
来减少它,但它给了我一些我无法弄清楚的警告,尽管@ 987654322@,不知道应该改什么,
buildTypes
release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
上面一行显示了build.gradle
在module:app中的sn-p
-keepattributes InnerClasses
这是我用来抑制 proguard-rules.pro
中的一些警告的方法,我确实在 Proguard 上查看了其他问题,但无法得到它。
我已经提到了我在尝试发布版本时收到的消息
Note: duplicate definition of library class [android.net.http.SslError]
Note: duplicate definition of library class [android.net.http.SslCertificate]
Note: duplicate definition of library class [android.net.http.SslCertificate$DName]
Note: duplicate definition of library class [org.apache.http.conn.scheme.HostNameResolver]
Note: duplicate definition of library class [org.apache.http.conn.scheme.SocketFactory]
Note: duplicate definition of library class [org.apache.http.conn.ConnectTimeoutException]
Note: duplicate definition of library class [org.apache.http.params.HttpParams]
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'
Note: android.support.v4.app.NotificationCompatJellybean calls 'Field.getType'
Note: com.google.android.gms.internal.zzsv 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'
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkUrlFactory
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
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.zzlh: can't find dynamically referenced class com.facebook.Session
Note: com.google.android.gms.internal.zzlh: can't find dynamically referenced class com.facebook.FacebookSdk
Note: com.google.android.gms.internal.zzlh: can't find dynamically referenced class com.facebook.login.LoginManager
Note: com.google.android.gms.internal.zzlh: can't find dynamically referenced class com.facebook.Session
Note: com.google.android.gms.internal.zzlh: can't find dynamically referenced class com.facebook.login.LoginManager
Note: com.google.android.gms.internal.zzlh: can't find dynamically referenced class com.facebook.Session$OpenRequest
Note: com.google.android.gms.internal.zzlh: can't find dynamically referenced class com.facebook.Session
Note: com.google.android.gms.internal.zzlh: can't find dynamically referenced class com.facebook.Session$StatusCallback
Note: com.google.android.gms.internal.zzlh: can't find dynamically referenced class com.facebook.Session
Note: com.google.android.gms.internal.zzlh: can't find dynamically referenced class com.facebook.Session$StatusCallback
Note: com.google.android.gms.internal.zzlh$1: can't find dynamically referenced class com.facebook.SessionState
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.squareup.picasso.Utils: can't find dynamically referenced class com.squareup.okhttp.OkUrlFactory
Note: com.squareup.picasso.Utils: can't find dynamically referenced class com.squareup.okhttp.OkHttpClient
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.nimgade.pk.mytest101.R$attr int icon; '
Maybe this is program field 'com.nimgade.pk.mytest101.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 '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.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.nimgade.pk.mytest101.R$attr int title; '
Maybe this is program field 'com.nimgade.pk.mytest101.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: com.google.gson.internal.UnsafeAllocator accesses a declared field 'theUnsafe' dynamically
Note: the configuration keeps the entry point 'android.support.design.widget.AppBarLayout void setWindowInsets(android.support.v4.view.WindowInsetsCompat); ', but not the descriptor class 'android.support.v4.view.WindowInsetsCompat'
Note: the configuration keeps the entry point 'android.support.design.widget.CoordinatorLayout void setWindowInsets(android.support.v4.view.WindowInsetsCompat); ', but not the descriptor class 'android.support.v4.view.WindowInsetsCompat'
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.v4.view.ViewPager void setOnAdapterChangeListener(android.support.v4.view.ViewPager$OnAdapterChangeListener); ', but not the descriptor class 'android.support.v4.view.ViewPager$OnAdapterChangeListener'
Note: the configuration keeps the entry point 'android.support.v4.view.ViewPager 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 'android.support.v4.widget.DrawerLayout void setDrawerListener(android.support.v4.widget.DrawerLayout$DrawerListener); ', but not the descriptor class 'android.support.v4.widget.DrawerLayout$DrawerListener'
Note: the configuration keeps the entry point 'android.support.v4.widget.NestedScrollView void setOnScrollChangeListener(android.support.v4.widget.NestedScrollView$OnScrollChangeListener); ', but not the descriptor class 'android.support.v4.widget.NestedScrollView$OnScrollChangeListener'
Note: the configuration keeps the entry point 'android.support.v4.widget.SlidingPaneLayout void setPanelSlideListener(android.support.v4.widget.SlidingPaneLayout$PanelSlideListener); ', but not the descriptor class 'android.support.v4.widget.SlidingPaneLayout$PanelSlideListener'
Note: the configuration keeps the entry point 'android.support.v4.widget.SwipeRefreshLayout void setOnRefreshListener(android.support.v4.widget.SwipeRefreshLayout$OnRefreshListener); ', but not the descriptor class 'android.support.v4.widget.SwipeRefreshLayout$OnRefreshListener'
Note: the configuration keeps the entry point 'android.support.v7.app.MediaRouteButton void setRouteSelector(android.support.v7.media.MediaRouteSelector); ', but not the descriptor class 'android.support.v7.media.MediaRouteSelector'
Note: the configuration keeps the entry point 'android.support.v7.app.MediaRouteButton void setDialogFactory(android.support.v7.app.MediaRouteDialogFactory); ', but not the descriptor class 'android.support.v7.app.MediaRouteDialogFactory'
Note: the configuration keeps the entry point 'android.support.v7.view.menu.ActionMenuItemView void setItemInvoker(android.support.v7.view.menu.MenuBuilder$ItemInvoker); ', but not the descriptor class 'android.support.v7.view.menu.MenuBuilder$ItemInvoker'
Note: the configuration keeps the entry point 'android.support.v7.view.menu.ActionMenuItemView void setPopupCallback(android.support.v7.view.menu.ActionMenuItemView$PopupCallback); ', but not the descriptor class 'android.support.v7.view.menu.ActionMenuItemView$PopupCallback'
Note: the configuration keeps the entry point 'android.support.v7.widget.ActionBarContainer void setTabContainer(android.support.v7.widget.ScrollingTabContainerView); ', but not the descriptor class 'android.support.v7.widget.ScrollingTabContainerView'
Note: the configuration keeps the entry point 'android.support.v7.widget.ActionBarOverlayLayout void setActionBarVisibilityCallback(android.support.v7.widget.ActionBarOverlayLayout$ActionBarVisibilityCallback); ', but not the descriptor class 'android.support.v7.widget.ActionBarOverlayLayout$ActionBarVisibilityCallback'
Note: the configuration keeps the entry point 'android.support.v7.widget.ActionMenuView void setPresenter(android.support.v7.widget.ActionMenuPresenter); ', but not the descriptor class 'android.support.v7.widget.ActionMenuPresenter'
Note: the configuration keeps the entry point 'android.support.v7.widget.ActionMenuView void setOnMenuItemClickListener(android.support.v7.widget.ActionMenuView$OnMenuItemClickListener); ', but not the descriptor class 'android.support.v7.widget.ActionMenuView$OnMenuItemClickListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.ActivityChooserView void setActivityChooserModel(android.support.v7.widget.ActivityChooserModel); ', but not the descriptor class 'android.support.v7.widget.ActivityChooserModel'
Note: the configuration keeps the entry point 'android.support.v7.widget.ActivityChooserView void setProvider(android.support.v4.view.ActionProvider); ', but not the descriptor class 'android.support.v4.view.ActionProvider'
Note: the configuration keeps the entry point 'android.support.v7.widget.ContentFrameLayout void setAttachListener(android.support.v7.widget.ContentFrameLayout$OnAttachListener); ', but not the descriptor class 'android.support.v7.widget.ContentFrameLayout$OnAttachListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.FitWindowsFrameLayout void setOnFitSystemWindowsListener(android.support.v7.widget.FitWindowsViewGroup$OnFitSystemWindowsListener); ', but not the descriptor class 'android.support.v7.widget.FitWindowsViewGroup$OnFitSystemWindowsListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.FitWindowsLinearLayout void setOnFitSystemWindowsListener(android.support.v7.widget.FitWindowsViewGroup$OnFitSystemWindowsListener); ', but not the descriptor class 'android.support.v7.widget.FitWindowsViewGroup$OnFitSystemWindowsListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView void setAccessibilityDelegateCompat(android.support.v7.widget.RecyclerViewAccessibilityDelegate); ', but not the descriptor class 'android.support.v7.widget.RecyclerViewAccessibilityDelegate'
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView void setAdapter(android.support.v7.widget.RecyclerView$Adapter); ', but not the descriptor class 'android.support.v7.widget.RecyclerView$Adapter'
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView void setRecyclerListener(android.support.v7.widget.RecyclerView$RecyclerListener); ', but not the descriptor class 'android.support.v7.widget.RecyclerView$RecyclerListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView void setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager); ', but not the descriptor class 'android.support.v7.widget.RecyclerView$LayoutManager'
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView void setRecycledViewPool(android.support.v7.widget.RecyclerView$RecycledViewPool); ', but not the descriptor class 'android.support.v7.widget.RecyclerView$RecycledViewPool'
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView void setViewCacheExtension(android.support.v7.widget.RecyclerView$ViewCacheExtension); ', but not the descriptor class 'android.support.v7.widget.RecyclerView$ViewCacheExtension'
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView void setChildDrawingOrderCallback(android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback); ', but not the descriptor class 'android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback'
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView void setOnScrollListener(android.support.v7.widget.RecyclerView$OnScrollListener); ', but not the descriptor class 'android.support.v7.widget.RecyclerView$OnScrollListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.RecyclerView void setItemAnimator(android.support.v7.widget.RecyclerView$ItemAnimator); ', but not the descriptor class 'android.support.v7.widget.RecyclerView$ItemAnimator'
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView void setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener); ', but not the descriptor class 'android.support.v7.widget.SearchView$OnQueryTextListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView void setOnCloseListener(android.support.v7.widget.SearchView$OnCloseListener); ', but not the descriptor class 'android.support.v7.widget.SearchView$OnCloseListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView void setOnSuggestionListener(android.support.v7.widget.SearchView$OnSuggestionListener); ', but not the descriptor class 'android.support.v7.widget.SearchView$OnSuggestionListener'
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView void setSuggestionsAdapter(android.support.v4.widget.CursorAdapter); ', but not the descriptor class 'android.support.v4.widget.CursorAdapter'
Note: the configuration keeps the entry point 'android.support.v7.widget.SearchView$SearchAutoComplete void setSearchView(android.support.v7.widget.SearchView); ', but not the descriptor class 'android.support.v7.widget.SearchView'
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.davemorrissey.labs.subscaleview.SubsamplingScaleImageView void setImage(com.davemorrissey.labs.subscaleview.ImageSource); ', but not the descriptor class 'com.davemorrissey.labs.subscaleview.ImageSource'
Note: the configuration keeps the entry point 'com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView void setRegionDecoderFactory(com.davemorrissey.labs.subscaleview.decoder.DecoderFactory); ', but not the descriptor class 'com.davemorrissey.labs.subscaleview.decoder.DecoderFactory'
Note: the configuration keeps the entry point 'com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView void setBitmapDecoderFactory(com.davemorrissey.labs.subscaleview.decoder.DecoderFactory); ', but not the descriptor class 'com.davemorrissey.labs.subscaleview.decoder.DecoderFactory'
Note: the configuration keeps the entry point 'com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView void setOnImageEventListener(com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$OnImageEventListener); ', but not the descriptor class 'com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$OnImageEventListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.AdView void setInAppPurchaseListener(com.google.android.gms.ads.purchase.InAppPurchaseListener); ', but not the descriptor class 'com.google.android.gms.ads.purchase.InAppPurchaseListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.AdView void setAdSize(com.google.android.gms.ads.AdSize); ', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.AdView void setAdListener(com.google.android.gms.ads.AdListener); ', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.BaseAdView void setAdListener(com.google.android.gms.ads.AdListener); ', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.BaseAdView void setAdSize(com.google.android.gms.ads.AdSize); ', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.BaseAdView void setInAppPurchaseListener(com.google.android.gms.ads.purchase.InAppPurchaseListener); ', but not the descriptor class 'com.google.android.gms.ads.purchase.InAppPurchaseListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.NativeExpressAdView void setInAppPurchaseListener(com.google.android.gms.ads.purchase.InAppPurchaseListener); ', but not the descriptor class 'com.google.android.gms.ads.purchase.InAppPurchaseListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.NativeExpressAdView void setAdSize(com.google.android.gms.ads.AdSize); ', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.NativeExpressAdView void setAdListener(com.google.android.gms.ads.AdListener); ', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView void setAdListener(com.google.android.gms.ads.AdListener); ', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView void setAdSizes(com.google.android.gms.ads.AdSize[]); ', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView void setAppEventListener(com.google.android.gms.ads.doubleclick.AppEventListener); ', but not the descriptor class 'com.google.android.gms.ads.doubleclick.AppEventListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView void setCorrelator(com.google.android.gms.ads.Correlator); ', but not the descriptor class 'com.google.android.gms.ads.Correlator'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.doubleclick.PublisherAdView void setOnCustomRenderedAdLoadedListener(com.google.android.gms.ads.doubleclick.OnCustomRenderedAdLoadedListener); ', but not the descriptor class 'com.google.android.gms.ads.doubleclick.OnCustomRenderedAdLoadedListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.formats.NativeAdView void setNativeAd(com.google.android.gms.ads.formats.NativeAd); ', but not the descriptor class 'com.google.android.gms.ads.formats.NativeAd'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.search.SearchAdView void setAdListener(com.google.android.gms.ads.AdListener); ', but not the descriptor class 'com.google.android.gms.ads.AdListener'
Note: the configuration keeps the entry point 'com.google.android.gms.ads.search.SearchAdView void setAdSize(com.google.android.gms.ads.AdSize); ', but not the descriptor class 'com.google.android.gms.ads.AdSize'
Note: the configuration keeps the entry point 'com.google.android.gms.flags.impl.FlagProviderImpl void init(com.google.android.gms.dynamic.zzd); ', but not the descriptor class 'com.google.android.gms.dynamic.zzd'
Note: the configuration keeps the entry point 'com.google.android.gms.plus.PlusOneButton void setOnPlusOneClickListener(com.google.android.gms.plus.PlusOneButton$OnPlusOneClickListener); ', but not the descriptor class 'com.google.android.gms.plus.PlusOneButton$OnPlusOneClickListener'
Note: there were 2 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 14 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 66 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 18 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 4 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 13 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.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
【问题讨论】:
嗨@pankaj,我好久没用安卓了,抱歉,帮不了你。 @CasparHarmer,好的,我明白了,谢谢 【参考方案1】:添加这个:
-dontwarn com.squareup.okhttp.**
到你的 proguard-rules.pro
【讨论】:
亲爱的你是我的救命稻草。在谷歌上搜索了很多,但没有一个解决方案有效,但这一行解决了所有警告。只是一个疑问,实际上是因为 okhttp,除了 okhttp 警告之外,为什么日志还打印“注意:配置引用未知类 'com.google.vending.licensing.ILicensingService'”?我的情况也是如此。【参考方案2】:您必须为每个库编写 pro-guard 规则,否则 pro-guard 会混淆它
这适用于 Admob
-keep public class com.google.ads.**
public *;
这是 V7 支持库
-dontwarn android.support.v7.**
-keep class android.support.v7.** *;
-keep interface android.support.v7.** *;
【讨论】:
你能告诉我如何“mapping.txt”和proguard生成的堆栈跟踪 你的意思是如何使用?以上是关于如何使用 proguard 获取发布构建 apk 文件的主要内容,如果未能解决你的问题,请参考以下文章
用于 Android Proguard 混淆的 ANT 构建
升级 gradle 后 Proguard 行为发生变化,从构建的 apk 中省略类
proguard applymapping - mapping.txt 的更改不适用于下一个构建签名的 apk