android – 使用Proguard构建时的多个警告

android – 使用Proguard构建时的多个警告,第1张

概述我真的想在我的应用程序中使用这个Proguard功能,但是看到那千个警告让我想知道它是否值得…我应该添加什么才能使它成功构建?或者让我知道这是否是一个失败的原因…… 这是我的Gradle文件: (……) buildTypes { release { minifyEnabled true shrinkResources true 我真的想在我的应用程序中使用这个Proguard功能,但是看到那千个警告让我想知道它是否值得…我应该添加什么才能使它成功构建?或者让我知道这是否是一个失败的原因……

这是我的Gradle文件:

(……)

buildTypes {        release {            MinifyEnabled true            shrinkResources true            proguardfiles getDefaultProguardfile('proguard-androID.txt'),'proguard-rules.pro'        }    }    packagingOptions {        exclude 'meta-inf/liCENSE'        exclude 'meta-inf/liCENSE-FIREBASE.txt'        exclude 'meta-inf/NOTICE'        exclude 'meta-inf/services/javax.annotation.processing.Processor'        exclude 'meta-inf/DEPENDENCIES'        exclude 'meta-inf/liCENSE.txt'        exclude 'meta-inf/NOTICE.txt'    }    lintoptions {        disable 'InvalIDPackage'        disable 'LongLogTag'    }    dexOptions {        jumboMode = true        javaMaxHeapSize "4g"    }    productFlavors {        // define separate dev and prod product flavors.        dev {            // dev utilizes minSDKVersion = 21 to allow the AndroID gradle plugin            // to pre-dex each module and produce an APK that can be tested on            // AndroID Lollipop without time consuming dex merging processes.            minSdkVersion 16            targetSdkVersion 19        }        prod {            // The actual minSdkVersion for the application.            minSdkVersion 16            targetSdkVersion 21        }    }}dependencIEs {    compile filetree(dir: 'libs',include: ['*.jar'])    compile 'com.androID.support:multIDex:1.0.0'    compile "com.androID.support:appcompat-v7:${supportlibVersion}"    compile 'com.androID.support:percent:23.4.0'    compile("com.androID.support:design:${supportlibVersion}") {        exclude module: 'support-v4'    }    compile("com.androID.support:cardvIEw-v7:${supportlibVersion}") {        exclude module: 'support-v4'    }    compile 'com.Google.androID.gms:play-services-gcm:8.4.0'    compile('com.firebase:firebase-clIEnt-androID:2.4.0') {        exclude module: 'jackson-databind'    }    compile('com.github.nkzawa:socket.io-clIEnt:0.4.1') {        exclude group: 'org.Json',module: 'Json'    }    compile('com.astuetz:pagerslIDingtabstrip:1.0.1') {        exclude module: 'support-v4'    }    compile('com.Google.androID.gms:play-services-location:8.4.0') {        exclude module: 'support-v4'    }    // This one use Maven : url "https://jitpack.io"    compile('org.glassfish.jersey.media:jersey-media-Json-jackson:2.22.2') {        exclude group: 'javax.inject',module: 'javax.inject'    }    compile('com.github.jakob-grabner:Circle-Progress-VIEw:v1.2.9') {        exclude group: 'support-annotations'    }    compile('com.github.ganfra:material-spinner:1.1.1') {        exclude group: 'com.androID.support',module: 'appcompat-v7'        exclude group: 'com.androID.support',module: 'support-v4'    }    compile 'com.jakewharton:butterknife:7.0.1'    compile 'commons-io:commons-io:2.4'    compile 'info.guardianproject.iocipher:IOCipher:0.3'    compile 'org.apache.commons:commons-lang3:3.4'    compile ("com.squareup.retrofit2:retrofit:2.0.0"){        exclude module: 'okhttp'    }    compile ("com.squareup.retrofit2:converter-jackson:2.0.0"){        exclude module: 'okhttp'    }    compile 'com.squareup.picasso:picasso:2.5.2'    compile 'com.amazonaws:aws-androID-sdk-sns:2.+'    compile 'com.github.rtoshiro.securesharedpreferences:securesharedpreferences:1.0.+'    compile 'de.hdodenhof:circleimagevIEw:2.0.0'    compile 'com.felipecsl.asymmetricgrIDvIEw:library:1.1.0'    compile 'com.joanzapata.androID:androID-iconify:1.0.9'    compile 'com.koushikdutta.async:androIDasync:2.+'    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'    compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'    compile 'com.github.johnpersano:supertoasts:1.3.4@aar'    compile 'com.github.ybq:AndroID-SpinKit:1.0.3'    compile 'com.timehop.stickyheadersrecyclervIEw:library:0.4.3@aar'    compile 'com.bigkoo:pickervIEw:2.0.8'    compile 'com.takwolf.androID:lock9vIEw:0.0.11'    compile 'com.kyleduo.switchbutton:library:1.4.0'    compile 'com.hanks.animatecheckBox:library:0.1'    compile 'com.code-troopers.betterpickers:library:2.5.5'}apply plugin: ('com.Google.gms.Google-services')

这是我的proguard-rule.pro文件:

###########################        RETROFIT        ############################ Add any project specific keep options here:-dontwarn retrofit2.**-keep class retrofit2.** { *; }-keepattributes Signature-keepattributes Exceptions-keepattributes Annotation###########################       BUTTERKNIFE      ###########################-keep class butterknife.** { *; }-dontwarn butterknife.internal.**-keep class **$$VIEwBinder { *; }-keepclasseswithmembernames class * {    @butterknife.* <fIElds>;}-keepclasseswithmembernames class * {    @butterknife.* <methods>;}###########################     JACKSON-PARSER     ###########################-keepattributes *Annotation*,EnclosingMethod,Signature-keepnames class com.fasterxml.jackson.** { *; } -dontwarn com.fasterxml.jackson.databind.** -keep class org.codehaus.** { *; } -keepclassmembers public final enum org.codehaus.jackson.annotate.JsonautoDetect$Visibility { public static final org.codehaus.jackson.annotate.JsonautoDetect$Visibility *; }-keep public class your.class.** {  public voID set*(***);  public *** get*();}-assumenosIDeeffects class androID.util.Log {public static *** d(...);public static *** v(...);public static *** i(...);public static *** w(...);public static *** e(...);public static *** wtf(...);    }

这些是剩下的警告:

(…)Warning:com.fasterxml.jackson.module.jaxb.deser.DataHandlerjsonDeserializer: can't find superclass or interface javax.activation.DataSourceWarning:javax.ws.rs.core.link$JaxbAdapter: can't find superclass or interface javax.xml.bind.annotation.adapters.XmlAdapterWarning:org.glassfish.hk2.osgiresourcelocator.Activator: can't find superclass or interface org.osgi.framework.BundleActivatorWarning:org.glassfish.hk2.osgiresourcelocator.ServiceLoaderImpl$BundleTracker: can't find superclass or interface org.osgi.framework.BundleListenerWarning:org.glassfish.jersey.internal.OsgiRegistry: can't find superclass or interface org.osgi.framework.SynchronousBundleListenerWarning:org.glassfish.jersey.message.internal.DataSourceProvIDer$ByteArrayDataSource: can't find superclass or interface javax.activation.DataSourceWarning:com.fasterxml.jackson.module.jaxb.AdapterConverter: can't find referenced class javax.xml.bind.annotation.adapters.XmlAdapterWarning:com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector: can't find referenced class javax.xml.bind.annotation.XmlElementWarning:com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector: can't find referenced class javax.xml.bind.annotation.XmlRootElementWarning:com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector: can't find referenced class javax.xml.bind.annotation.XmlElementWarning:com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector: can't find referenced class javax.xml.bind.annotation.XmlAttributeWarning:com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector: can't find referenced class javax.xml.bind.annotation.XmlValueWarning:com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector: can't find referenced class javax.xml.bind.annotation.XmlElementsWarning:com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector: can't find referenced class javax.xml.bind.annotation.XmlAccesstypeWarning:com.fasterxml.jackson.module.jaxb.deser.DataHandlerjsonDeserializer: can't find referenced class javax.activation.DataHandlerWarning:com.fasterxml.jackson.module.jaxb.deser.DataHandlerjsonDeserializer: can't find referenced class javax.activation.DataSourceWarning:com.fasterxml.jackson.module.jaxb.ser.DataHandlerjsonSerializer: can't find referenced class javax.activation.DataHandlerWarning:com.felipecsl.asymmetricgrIDvIEw.library.Widget.AnimatorProxy: can't find referenced method 'float floor(float)' in library class androID.util.floatMathWarning:com.felipecsl.asymmetricgrIDvIEw.library.Widget.AnimatorProxy: can't find referenced method 'float ceil(float)' in library class androID.util.floatMathWarning:com.Google.common.base.Equivalence: can't find referenced class javax.annotation.NullableWarning:com.Google.common.base.Equivalences$Impl: can't find referenced class javax.annotation.NullableWarning:com.Google.common.base.Equivalences$Impl: can't find referenced class javax.annotation.NullableWarning:com.Google.common.base.Function: can't find referenced class javax.annotation.NullableWarning:com.Google.common.base.Functions: can't find referenced class javax.annotation.NullableWarning:com.Google.common.base.Functions$ConstantFunction: can't find referenced class javax.annotation.NullableWarning:com.squareup.picasso.OkhttpDownloader: can't find referenced class com.squareup.okhttp.OkhttpClIEntWarning:com.squareup.picasso.OkhttpDownloader: can't find referenced class com.squareup.okhttp.CacheWarning:com.squareup.picasso.OkhttpDownloader: can't find referenced class com.squareup.okhttp.OkhttpClIEntWarning:com.squareup.picasso.OkhttpDownloader: can't find referenced class com.squareup.okhttp.CacheControlWarning:com.squareup.picasso.OkhttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$BuilderWarning:com.squareup.picasso.OkhttpDownloader: can't find referenced class com.squareup.okhttp.Request$BuilderWarning:com.squareup.picasso.OkhttpDownloader: can't find referenced class com.squareup.okhttp.OkhttpClIEntWarning:com.squareup.picasso.OkhttpDownloader: can't find referenced class com.squareup.okhttp.CallWarning:javassist.tools.rmi.Objectimporter: can't find referenced class java.applet.AppletWarning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.connect.AttachingConnectorWarning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.connect.Connector$ArgumentWarning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.connect.AttachingConnectorWarning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.VirtualMachineWarning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.bootstrapWarning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.VirtualMachineManagerWarning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.connect.ConnectorWarning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.event.EventQueueWarning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.VirtualMachineWarning:javax.ws.rs.core.link$JaxbAdapter: can't find referenced class javax.xml.bind.annotation.adapters.XmlAdapterWarning:javax.ws.rs.core.link$Jaxblink: can't find referenced class javax.xml.bind.annotation.XmlAttributeWarning:javax.ws.rs.core.link$Jaxblink: can't find referenced class javax.xml.bind.annotation.XmlAnyAttributeWarning:jersey.repackaged.com.Google.common.base.Absent: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.Converter: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.Equivalence: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.Function: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.Joiner: can't find referenced class javax.annotation.CheckReturnValueWarning:jersey.repackaged.com.Google.common.base.Joiner: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.MoreObjects: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.MoreObjects$ToStringHelper: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.Objects: can't find referenced class javax.annotation.CheckReturnValueWarning:jersey.repackaged.com.Google.common.base.Objects: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.Predicates$ObjectPredicate: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.Predicates$ObjectPredicate: can't find referenced class javax.annotation.NullableWarning:jersey.repackaged.com.Google.common.base.Predicates$OrPredicate: can't find referenced class javax.annotation.NullableWarning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirementWarning:okio.Okio: can't find referenced class java.nio.file.filesWarning:okio.Okio: can't find referenced class java.nio.file.PathWarning:okio.Okio: can't find referenced class java.nio.file.OpenoptionWarning:okio.Okio: can't find referenced class java.nio.file.PathWarning:okio.Okio: can't find referenced class java.nio.file.OpenoptionWarning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirementWarning:okio.Okio: can't find referenced class java.nio.file.PathWarning:okio.Okio: can't find referenced class java.nio.file.OpenoptionWarning:okio.Okio: can't find referenced class java.nio.file.PathWarning:okio.Okio: can't find referenced class java.nio.file.OpenoptionWarning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirementWarning:org.glassfish.hk2.osgiresourcelocator.Activator: can't find referenced class org.osgi.framework.BundleActivatorWarning:org.glassfish.hk2.osgiresourcelocator.Activator: can't find referenced class org.osgi.framework.BundleContextWarning:org.glassfish.hk2.osgiresourcelocator.ResourceFinderImpl: can't find referenced class org.osgi.framework.BundleReferenceWarning:org.glassfish.hk2.osgiresourcelocator.ResourceFinderImpl: can't find referenced class org.osgi.framework.BundleWarning:org.glassfish.hk2.osgiresourcelocator.ResourceFinderImpl: can't find referenced class org.osgi.framework.BundleContextWarning:org.glassfish.hk2.osgiresourcelocator.ResourceFinderImpl: can't find referenced class org.osgi.framework.BundleWarning:org.glassfish.hk2.osgiresourcelocator.ResourceFinderImpl: can't find referenced class org.osgi.framework.BundleContextWarning:org.glassfish.hk2.osgiresourcelocator.ResourceFinderImpl: can't find referenced class org.osgi.framework.BundleWarning:org.glassfish.hk2.utilitIEs.reflection.BeanReflectionHelper: can't find referenced class java.beans.IntrospectorWarning:org.glassfish.jersey.internal.OsgiRegistry: can't find referenced class org.osgi.framework.BundleReferenceWarning:org.glassfish.jersey.internal.OsgiRegistry: can't find referenced class org.osgi.framework.FrameworkUtilWarning:org.glassfish.jersey.internal.OsgiRegistry: can't find referenced class org.osgi.framework.BundleWarning:org.glassfish.jersey.internal.OsgiRegistry: can't find referenced class org.osgi.framework.BundleEventWarning:org.glassfish.jersey.internal.OsgiRegistry: can't find referenced class org.osgi.framework.BundleWarning:org.glassfish.jersey.internal.OsgiRegistry$BundleSpiProvIDersLoader: can't find referenced class org.osgi.framework.BundleWarning:org.glassfish.jersey.internal.util.ReflectionHelper: can't find referenced class org.osgi.framework.FrameworkUtilWarning:org.glassfish.jersey.internal.util.ReflectionHelper: can't find referenced class org.osgi.framework.BundleWarning:org.glassfish.jersey.internal.util.ReflectionHelper: can't find referenced class org.osgi.framework.FrameworkUtilWarning:org.glassfish.jersey.internal.util.ReflectionHelper: can't find referenced class org.osgi.framework.BundleWarning:org.glassfish.jersey.internal.util.collection.ConcurrentHashMapV8: can't find referenced class sun.misc.UnsafeWarning:org.glassfish.jersey.internal.util.collection.ConcurrentHashMapV8: can't find referenced class sun.misc.UnsafeWarning:org.glassfish.jersey.internal.util.collection.ConcurrentHashMapV8$TreeBin: can't find referenced class sun.misc.UnsafeWarning:org.glassfish.jersey.internal.util.collection.linkedTransferQueue: can't find referenced class sun.misc.UnsafeWarning:org.glassfish.jersey.internal.util.collection.linkedTransferQueue: can't find referenced class sun.misc.UnsafeWarning:org.glassfish.jersey.internal.util.collection.linkedTransferQueue$Node: can't find referenced class sun.misc.UnsafeWarning:org.glassfish.jersey.message.filtering.SecurityEntityFilteringFeature: can't find referenced class org.glassfish.jersey.server.filter.RolesAllowedDynamicFeatureWarning:org.glassfish.jersey.message.filtering.ServerScopeProvIDer: can't find referenced class org.glassfish.jersey.server.ExtendedUriInfoWarning:org.glassfish.jersey.message.filtering.ServerScopeProvIDer: can't find referenced class org.glassfish.jersey.server.model.ResourceMethodWarning:org.glassfish.jersey.message.filtering.ServerScopeProvIDer: can't find referenced class org.glassfish.jersey.server.model.invocableWarning:org.glassfish.jersey.message.filtering.ServerScopeProvIDer: can't find referenced class org.glassfish.jersey.server.model.MethodHandlerWarning:org.glassfish.jersey.message.filtering.ServerScopeProvIDer: can't find referenced class org.glassfish.jersey.server.ExtendedUriInfoWarning:org.glassfish.jersey.message.filtering.ServerScopeProvIDer: can't find referenced class org.glassfish.jersey.server.model.ResourceMethodWarning:org.glassfish.jersey.message.filtering.ServerScopeProvIDer: can't find referenced class org.glassfish.jersey.server.ExtendedUriInfoWarning:org.glassfish.jersey.message.filtering.ServerScopeProvIDer: can't find referenced class org.glassfish.jersey.server.model.ResourceMethodWarning:org.glassfish.jersey.message.filtering.spi.FilteringHelper: can't find referenced class javax.xml.bind.JAXBElementWarning:org.glassfish.jersey.message.internal.DataSourceProvIDer: can't find referenced class javax.activation.DataSourceWarning:org.glassfish.jersey.message.internal.DataSourceProvIDer$ByteArrayDataSource: can't find referenced class javax.activation.DataSourceWarning:org.glassfish.jersey.message.internal.RenderedImageProvIDer: can't find referenced class java.awt.image.RenderedImageWarning:org.glassfish.jersey.message.internal.RenderedImageProvIDer: can't find referenced class java.awt.image.BufferedImageWarning:org.glassfish.jersey.message.internal.RenderedImageProvIDer: can't find referenced class javax.imageio.ImageIOWarning:org.glassfish.jersey.message.internal.RenderedImageProvIDer: can't find referenced class javax.imageio.ImageReaderWarning:org.glassfish.jersey.message.internal.RenderedImageProvIDer: can't find referenced class javax.imageio.ImageIOWarning:org.glassfish.jersey.message.internal.RenderedImageProvIDer: can't find referenced class javax.imageio.ImageReaderWarning:org.glassfish.jersey.message.internal.RenderedImageProvIDer: can't find referenced class java.awt.image.RenderedImageWarning:org.glassfish.jersey.message.internal.RenderedImageProvIDer: can't find referenced class javax.imageio.ImageWriterWarning:org.glassfish.jersey.message.internal.RenderedImageProvIDer: can't find referenced class java.awt.image.RenderedImage(…)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 11 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 143 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 30 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)Warning:there were 1911 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 2 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:transformClassesAndResourcesWithProguardForProdRelease FailedError:Execution Failed for task ':app:transformClassesAndResourcesWithProguardForProdRelease'.> java.io.IOException: Please correct the above warnings first.information:BUILD Failedinformation:Total time: 7.152 secsinformation:1 errorinformation:901 warningsinformation:See complete output in console
@H_403_16@解决方法 我通常需要告诉proguard保留第三方库以使其成功构建.例如,ID为Okio和fasterxml添加以下内容:
-keep class okio.** { *; }-dontwarn okio.**-keep class com.fasterxml.** { *; }-dontwarn com.fasterxml.**

为项目中包含的每个第三方库添加上述内容.从你的日志我看到glassfish,jersey,squareup,Google,Okio和fasterxml.

以下是有关上面列出的proguard规则的更多信息:

Using “dontwarn” in proguard

Android Proguard – is it best practice to -keep all 3rd party libs?

@H_403_16@ @H_403_16@ 总结

以上是内存溢出为你收集整理的android – 使用Proguard构建时的多个警告全部内容,希望文章能够帮你解决android – 使用Proguard构建时的多个警告所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1145467.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存