Android应用程序Proguard规则

时间:2016-12-15 19:33:53

标签: android proguard obfuscation minify android-proguard

在没有对proguard文件进行任何更改的情况下构建已签名的apk(使用minifiyEnabled为true)时,我收到以下警告:

Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find superclass or interface java.awt.datatransfer.Transferable
Warning:org.apache.harmony.awt.datatransfer.NativeClipboard: can't find superclass or interface java.awt.datatransfer.Clipboard
Warning:com.github.omadahealth.typefaceview.TypefaceEditText: can't find referenced class android.databinding.BindingAdapter
Warning:com.github.omadahealth.typefaceview.TypefaceTextView: can't find referenced class android.databinding.BindingAdapter
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.Sasl
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.SaslClient
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.SaslException
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.SaslClient
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.SaslException
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator$1: can't find referenced class javax.security.auth.callback.NameCallback
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator$1: can't find referenced class javax.security.sasl.RealmCallback
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator$1: can't find referenced class javax.security.sasl.RealmChoiceCallback
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator$1: can't find referenced class javax.security.auth.callback.NameCallback
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator$1: can't find referenced class javax.security.sasl.RealmCallback
Warning:com.sun.mail.imap.protocol.IMAPSaslAuthenticator$1: can't find referenced class javax.security.sasl.RealmChoiceCallback
Warning:com.yarolegovich.lovelydialog.LovelyCustomDialog: can't find referenced field 'int ld_custom_view_container' in program class com.yarolegovich.lovelydialog.R$id
Warning:javax.activation.CommandInfo: can't find referenced class java.beans.Beans
Warning:org.apache.harmony.awt.ContextStorage: can't find referenced class java.awt.Toolkit
Warning:org.apache.harmony.awt.ContextStorage: can't find referenced class java.awt.GraphicsEnvironment
Warning:org.apache.harmony.awt.ContextStorage: can't find referenced class java.awt.Toolkit
Warning:org.apache.harmony.awt.ContextStorage: can't find referenced class java.awt.GraphicsEnvironment
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.dnd.DropTargetContext
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.dnd.peer.DropTargetContextPeer
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.dnd.DragGestureEvent
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.dnd.peer.DragSourceContextPeer
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DataProvider: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.Transferable
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.UnsupportedFlavorException
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.Image
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.UnsupportedFlavorException
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.DirectColorModel
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.DataBufferInt
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.Raster
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.ComponentColorModel
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.color.ColorSpace
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.ComponentColorModel
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.DataBufferByte
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.Raster
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.DataBufferUShort
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.BufferedImage
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.Image
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.BufferedImage
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.ColorModel
Warning:org.apache.harmony.awt.datatransfer.DataProxy: can't find referenced class java.awt.image.WritableRaster
Warning:org.apache.harmony.awt.datatransfer.DataSnapshot: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DataSnapshot: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.Transferable
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.Transferable
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.Image
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.image.BufferedImage
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.Image
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.image.BufferedImage
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.Graphics
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.image.BufferedImage
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.image.WritableRaster
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.image.DataBufferInt
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.Transferable
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.Image
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.image.BufferedImage
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.Graphics
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.image.BufferedImage
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.image.DataBufferInt
Warning:org.apache.harmony.awt.datatransfer.DataSource: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.Point
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceContext
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceEvent
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceContext
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceDropEvent
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceDragEvent
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceContext 
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.Point
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceContext
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.Point
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find  referenced class java.awt.dnd.DragSourceContext
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.Point
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceContext
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.Point
Warning:org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceDragEvent
Warning:org.apache.harmony.awt.datatransfer.FlavorsComparator: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.NativeClipboard: can't find referenced class java.awt.datatransfer.Clipboard
Warning:org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.SystemFlavorMap
Warning:org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.DataFlavor
Warning:there were 250 unresolved references to classes or interfaces.
Warning:there were 1 unresolved references to program class members.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.

我知道这是因为proguard混淆了一些不应混淆的类。

但是如果我在proguard文件中添加任何代码来解决这个问题,例如:

-keep class javax.security.sasl {*;}

gradle构建开始并在transformclassesandresourceswithproguardforrelease阶段停留数小时而没有任何警告。

我请求你们帮我处理proguard规则,以确保我能够生成签名的apk

(目录结构:

-app

-lib

lib是一个库文件夹,不需要进行模糊处理)

0 个答案:

没有答案