1
我正在嘗試使用proguard構建我的應用程序的發佈版本,以便我可以縮小資源並混淆我的代碼。我面臨着一些引用和庫類問題,這些問題在運行時無法找到,因此我給出了一些警告,如下所述。Gradle在使用Proguard編譯發佈版本時無法找到一些引用類庫和庫類
搖籃控制檯警告
編譯使用ProGuard
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find superclass or interface java.awt.Shape
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find superclass or interface java.awt.Shape
Warning:com.vividsolutions.jts.awt.ShapeCollectionPathIterator: can't find superclass or interface java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.ShapeCollectionPathIterator$1: can't find superclass or interface java.awt.geom.PathIterator
Warning:library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
Warning:com.google.firebase.messaging.FirebaseMessaging: can't find referenced method 'void zziy(java.lang.String)' in program class com.google.firebase.iid.FirebaseInstanceId
Warning:com.google.firebase.messaging.FirebaseMessaging: can't find referenced method 'java.lang.String zzaX(android.content.Context)' in program class com.google.firebase.iid.zzf
Warning:com.google.firebase.messaging.FirebaseMessagingService: can't find referenced method 'android.content.Intent zzUr()' in program class com.google.firebase.iid.FirebaseInstanceIdInternalReceiver
Warning:com.google.firebase.messaging.FirebaseMessagingService: can't find referenced method 'int zzA(android.content.Intent)' in program class com.google.firebase.iid.zzb
Warning:com.google.firebase.messaging.FirebaseMessagingService: can't find referenced method 'void zzBL()' in program class com.google.firebase.messaging.FirebaseMessagingService
Warning:com.google.firebase.messaging.zzb: can't find referenced method 'void zza(java.lang.String,java.lang.String,java.lang.Object)' in program class com.google.android.gms.measurement.AppMeasurement
Warning:com.google.firebase.messaging.zzc: can't find referenced method 'int zzap(android.os.Parcel)' in program class com.google.android.gms.common.internal.safeparcel.zza
Warning:com.google.firebase.messaging.zzc: can't find referenced method 'int zzaq(android.os.Parcel)' in program class com.google.android.gms.common.internal.safeparcel.zza
Warning:com.google.firebase.messaging.zzc: can't find referenced method 'int zzcj(int)' in program class com.google.android.gms.common.internal.safeparcel.zza
Warning:com.google.firebase.messaging.zzc: can't find referenced method 'void zzJ(android.os.Parcel,int)' in program class com.google.android.gms.common.internal.safeparcel.zzb
Warning:com.google.firebase.messaging.zzc: can't find referenced method 'int zzar(android.os.Parcel)' in program class com.google.android.gms.common.internal.safeparcel.zzb
Warning:com.vividsolutions.jts.awt.FontGlyphReader: can't find referenced class java.awt.Font
Warning:com.vividsolutions.jts.awt.FontGlyphReader: can't find referenced class java.awt.font.FontRenderContext
Warning:com.vividsolutions.jts.awt.FontGlyphReader: can't find referenced class java.awt.Font
Warning:com.vividsolutions.jts.awt.FontGlyphReader: can't find referenced class java.awt.font.GlyphVector
Warning:com.vividsolutions.jts.awt.FontGlyphReader: can't find referenced class java.awt.Font
Warning:com.vividsolutions.jts.awt.FontGlyphReader: can't find referenced class java.awt.font.FontRenderContext
Warning:com.vividsolutions.jts.awt.FontGlyphReader: can't find referenced class java.awt.font.GlyphVector
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.Rectangle2D
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.Rectangle
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.Rectangle2D
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.Rectangle2D
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.Rectangle2D
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.AffineTransform
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.AffineTransform
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.GeometryCollectionShape: can't find referenced class java.awt.geom.AffineTransform
Warning:com.vividsolutions.jts.awt.IdentityPointTransformation: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PointShapeFactory$BasePointShapeFactory: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$BasePointShapeFactory: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.geom.Ellipse2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.geom.Ellipse2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.geom.Ellipse2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.geom.Ellipse2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Circle: can't find referenced class java.awt.geom.Ellipse2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Cross: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Cross: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Cross: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Cross: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Cross: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Cross: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Point: can't find referenced class java.awt.geom.Line2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Point: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Point: can't find referenced class java.awt.geom.Line2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Point: can't find referenced class java.awt.geom.Line2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Point: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Point: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Point: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Point: can't find referenced class java.awt.geom.Line2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.geom.Rectangle2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.geom.Rectangle2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.geom.Rectangle2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.geom.Rectangle2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Square: can't find referenced class java.awt.geom.Rectangle2D$Double
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Star: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Star: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Star: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Star: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Star: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Star: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Star: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Triangle: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Triangle: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Triangle: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Triangle: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Triangle: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Triangle: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$Triangle: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$X: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$X: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$X: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointShapeFactory$X: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$X: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PointShapeFactory$X: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PointShapeFactory$X: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PointTransformation: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.Rectangle
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.Rectangle2D
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.Rectangle2D
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.AffineTransform
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.AffineTransform
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.PolygonShape: can't find referenced class java.awt.geom.AffineTransform
Warning:com.vividsolutions.jts.awt.ShapeCollectionPathIterator: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.ShapeCollectionPathIterator: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.ShapeCollectionPathIterator: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.ShapeCollectionPathIterator: can't find referenced class java.awt.geom.AffineTransform
Warning:com.vividsolutions.jts.awt.ShapeCollectionPathIterator$1: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.ShapeReader: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.ShapeReader: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.ShapeReader: can't find referenced class java.awt.geom.AffineTransform
Warning:com.vividsolutions.jts.awt.ShapeReader: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.ShapeReader: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.ShapeReader: can't find referenced class java.awt.geom.AffineTransform
Warning:com.vividsolutions.jts.awt.ShapeReader: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.ShapeReader: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.ShapeReader: can't find referenced class java.awt.geom.PathIterator
Warning:com.vividsolutions.jts.awt.ShapeWriter: can't find referenced class java.awt.geom.Point2D$Double
Warning:com.vividsolutions.jts.awt.ShapeWriter: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.ShapeWriter: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.ShapeWriter: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.ShapeWriter: can't find referenced class java.awt.geom.Point2D
Warning:com.vividsolutions.jts.awt.ShapeWriter: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.ShapeWriter: can't find referenced class java.awt.geom.GeneralPath
Warning:com.vividsolutions.jts.awt.ShapeWriter: can't find referenced class java.awt.Shape
Warning:com.vividsolutions.jts.awt.ShapeWriter: can't find referenced class java.awt.geom.Point2D
Warning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio: can't find referenced class java.nio.file.Files
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class java.nio.file.Path
Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandle
Warning:retrofit2.Platform$Java8: can't find referenced class java.lang.invoke.MethodHandles$Lookup
Warning:retrofit2.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:library class android.content.Intent depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlSerializer
Warning:library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.content.res.ColorStateList depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.AnimatedVectorDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.AnimationDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.BitmapDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.ClipDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.ColorDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.DrawableWrapper depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.GradientDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.InsetDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.LayerDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.RippleDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.ScaleDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.ShapeDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.StateListDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.graphics.drawable.VectorDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.util.Xml depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.util.Xml depends on program class org.xmlpull.v1.XmlSerializer
Warning:library class android.util.Xml depends on program class org.xmlpull.v1.XmlPullParser
Warning:library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
proguard-rules.pro準備發佈版本,當我面對這些警告
我嘗試了很多讓擺脫了這些警告,但沒有找到任何有效的解決方案。我ProGuard的規則定義如下:
-printconfiguration config.txt
#-keep class * extends android.app.Activity
#-keep class * extends android.support.v4.app.Fragment
#-keep class * extends Application
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** i(...);
public static *** e(...);
}
-keepattributes Signature
-keepattributes InnerClasses
#-keepattributes *Annotation*
-dontnote org.xmlpull.v1.**
-dontnote org.apache.http.**
-dontnote android.net.http.**
-keepclasseswithmembers,includedescriptorclasses class * { *; }
#-keep class com.vividsolutions.jts.awt.** { *; }
#-keep class android.content.XMLResourceParser { *; }
#-keep class com.google.firebase.messaging.** { *; }
#-keep class okio.** { *; }
#-keep class retrofit2.** { *; }
-keep class java.awt.** { *; }
-keep class com.google.firebase.iid.** { *; }
-keep class com.google.firebase.messaging.FirebaseMessagingService { *; }
-keep class com.google.android.gms.measurement.AppMeasurement { *; }
-keep class com.google.android.gms.common.internal.safeparcel.** { *; }
-keep class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement { *; }
-keep class java.nio.file.**
-keep class java.lang.invoke.**
-keep class org.xmlpull.v1.XmlPullParser { *; }
的build.gradle [應用]
packagingOptions {
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
-ignorewarnings可能稍後會帶來問題 – Fabio