无法构建发布apk

时间:2017-10-19 15:11:44

标签: java android android-proguard

我正在尝试构建我的项目以获取发布apk我收到一堆警告,我无法让它工作

警告:

Note: duplicate definition of library class [org.apache.http.HttpRequestInterceptor]
Note: duplicate definition of library class [org.apache.http.HttpServerConnection]
Note: duplicate definition of library class [org.apache.http.ProtocolVersion]
Note: duplicate definition of library class [org.apache.http.params.BasicHttpParams]
Note: duplicate definition of library class [org.apache.http.params.CoreProtocolPNames]
Note: duplicate definition of library class [org.apache.http.params.HttpProtocolParamBean]
Note: duplicate definition of library class [org.apache.http.params.HttpAbstractParamBean]
Note: duplicate definition of library class [org.apache.http.params.HttpConnectionParams]
Note: duplicate definition of library class [org.apache.http.params.DefaultedHttpParams]
Note: duplicate definition of library class [org.apache.http.params.HttpProtocolParams]
Note: duplicate definition of library class [org.apache.http.params.HttpConnectionParamBean]
Note: duplicate definition of library class [org.apache.http.params.HttpParams]
Note: duplicate definition of library class [org.apache.http.params.CoreConnectionPNames]
Note: duplicate definition of library class [org.apache.http.params.AbstractHttpParams]
Note: duplicate definition of library class [org.apache.http.HttpConnectionMetrics]
Note: duplicate definition of library class [org.apache.http.message.BasicHeaderIterator]
Note: duplicate definition of library class [org.apache.http.message.BasicHeaderElement]
Note: duplicate definition of library class [org.apache.http.message.BasicHeaderElementIterator]
Note: duplicate definition of library class [org.apache.http.message.BasicHeaderValueFormatter]
Note: duplicate definition of library class [org.apache.http.message.BasicHeader]
Note: duplicate definition of library class [org.apache.http.message.LineParser]
Note: duplicate definition of library class [org.apache.http.message.HeaderGroup]
Note: duplicate definition of library class [org.apache.http.message.BasicLineParser]
Note: duplicate definition of library class [org.apache.http.message.BufferedHeader]
Note: duplicate definition of library class [org.apache.http.message.BasicHttpRequest]
Note: duplicate definition of library class [org.apache.http.message.BasicLineFormatter]
Note: duplicate definition of library class [org.apache.http.message.BasicTokenIterator]
Note: duplicate definition of library class [org.apache.http.message.BasicListHeaderIterator]
Note: duplicate definition of library class [org.apache.http.message.BasicHttpEntityEnclosingRequest]
Note: duplicate definition of library class [org.apache.http.message.HeaderValueFormatter]
Note: duplicate definition of library class [org.apache.http.message.BasicNameValuePair]
Note: duplicate definition of library class [org.apache.http.message.BasicHttpResponse]
Note: duplicate definition of library class [org.apache.http.message.AbstractHttpMessage]
Note: duplicate definition of library class [org.apache.http.message.BasicHeaderValueParser]
Note: duplicate definition of library class [org.apache.http.message.LineFormatter]
Note: duplicate definition of library class [org.apache.http.message.BasicRequestLine]
Note: duplicate definition of library class [org.apache.http.message.HeaderValueParser]
Note: duplicate definition of library class [org.apache.http.message.ParserCursor]
Note: duplicate definition of library class [org.apache.http.message.BasicStatusLine]
Note: duplicate definition of library class [org.apache.http.HttpVersion]
Note: duplicate definition of library class [org.apache.http.cookie.params.CookieSpecParamBean]
Note: duplicate definition of library class [org.apache.http.cookie.params.CookieSpecPNames]
Note: duplicate definition of library class [org.apache.http.cookie.CookiePathComparator]
Note: duplicate definition of library class [org.apache.http.cookie.ClientCookie]
Note: duplicate definition of library class [org.apache.http.cookie.CookieSpec]
Note: duplicate definition of library class [org.apache.http.cookie.SetCookie]
Note: duplicate definition of library class [org.apache.http.cookie.CookieOrigin]
Note: duplicate definition of library class [org.apache.http.cookie.SM]
Note: duplicate definition of library class [org.apache.http.cookie.CookieSpecRegistry]
Note: duplicate definition of library class [org.apache.http.cookie.CookieSpecFactory]
Note: duplicate definition of library class [org.apache.http.cookie.MalformedCookieException]
Note: duplicate definition of library class [org.apache.http.cookie.CookieAttributeHandler]
Note: duplicate definition of library class [org.apache.http.cookie.SetCookie2]
Note: duplicate definition of library class [org.apache.http.cookie.CookieIdentityComparator]
Note: duplicate definition of library class [org.apache.http.cookie.Cookie]
Note: duplicate definition of library class [org.apache.http.HttpEntityEnclosingRequest]
Note: duplicate definition of library class [org.apache.http.TokenIterator]
Note: duplicate definition of library class [org.apache.http.ProtocolException]
Note: duplicate definition of library class [org.apache.http.ReasonPhraseCatalog]
Note: duplicate definition of library class [org.apache.http.io.HttpMessageWriter]
Note: duplicate definition of library class [org.apache.http.io.HttpTransportMetrics]
Note: duplicate definition of library class [org.apache.http.io.HttpMessageParser]
Note: duplicate definition of library class [org.apache.http.io.SessionOutputBuffer]
Note: duplicate definition of library class [org.apache.http.io.SessionInputBuffer]
Note: duplicate definition of library class [org.apache.http.NameValuePair]
Note: duplicate definition of library class [org.apache.http.auth.params.AuthPNames]
Note: duplicate definition of library class [org.apache.http.auth.params.AuthParams]
Note: duplicate definition of library class [org.apache.http.auth.params.AuthParamBean]
Note: duplicate definition of library class [org.apache.http.auth.NTUserPrincipal]
Note: duplicate definition of library class [org.apache.http.auth.NTCredentials]
Note: duplicate definition of library class [org.apache.http.auth.Credentials]
Note: duplicate definition of library class [org.apache.http.auth.UsernamePasswordCredentials]
Note: duplicate definition of library class [org.apache.http.auth.AuthSchemeFactory]
Note: duplicate definition of library class [org.apache.http.auth.InvalidCredentialsException]
Note: duplicate definition of library class [org.apache.http.auth.AuthenticationException]
Note: duplicate definition of library class [org.apache.http.auth.AuthState]
Note: duplicate definition of library class [org.apache.http.auth.BasicUserPrincipal]
Note: duplicate definition of library class [org.apache.http.auth.AUTH]
Note: duplicate definition of library class [org.apache.http.auth.AuthScheme]
Note: duplicate definition of library class [org.apache.http.auth.AuthScope]
Note: duplicate definition of library class [org.apache.http.auth.AuthSchemeRegistry]
Note: duplicate definition of library class [org.apache.http.auth.MalformedChallengeException]
Note: duplicate definition of library class [org.apache.http.HttpHost]
Note: duplicate definition of library class [org.apache.http.HttpStatus]
Note: duplicate definition of library class [org.apache.http.HttpRequest]
Note: duplicate definition of library class [org.apache.commons.logging.LogSource]
Note: duplicate definition of library class [org.apache.commons.logging.impl.NoOpLog]
Note: duplicate definition of library class [org.apache.commons.logging.impl.LogFactoryImpl]
Note: duplicate definition of library class [org.apache.commons.logging.impl.Jdk14Logger]
Note: duplicate definition of library class [org.apache.commons.logging.impl.WeakHashtable]
Note: duplicate definition of library class [org.apache.commons.logging.impl.SimpleLog]
Note: duplicate definition of library class [org.apache.commons.logging.LogConfigurationException]
Note: duplicate definition of library class [org.apache.commons.logging.Log]
Note: duplicate definition of library class [org.apache.commons.logging.LogFactory]
Note: duplicate definition of library class [org.apache.commons.codec.StringDecoder]
Note: duplicate definition of library class [org.apache.commons.codec.BinaryDecoder]
Note: duplicate definition of library class [org.apache.commons.codec.binary.Hex]
Note: duplicate definition of library class [org.apache.commons.codec.binary.Base64]
Note: duplicate definition of library class [org.apache.commons.codec.binary.BinaryCodec]
Note: duplicate definition of library class [org.apache.commons.codec.EncoderException]
Note: duplicate definition of library class [org.apache.commons.codec.DecoderException]
Note: duplicate definition of library class [org.apache.commons.codec.BinaryEncoder]
Note: duplicate definition of library class [org.apache.commons.codec.Decoder]
Note: duplicate definition of library class [org.apache.commons.codec.StringEncoder]
Note: duplicate definition of library class [org.apache.commons.codec.language.RefinedSoundex]
Note: duplicate definition of library class [org.apache.commons.codec.language.DoubleMetaphone]
Note: duplicate definition of library class [org.apache.commons.codec.language.Metaphone]
Note: duplicate definition of library class [org.apache.commons.codec.language.Soundex]
Note: duplicate definition of library class [org.apache.commons.codec.language.DoubleMetaphone$DoubleMetaphoneResult]
Note: duplicate definition of library class [org.apache.commons.codec.StringEncoderComparator]
Note: duplicate definition of library class [org.apache.commons.codec.Encoder]
Note: duplicate definition of library class [org.apache.commons.codec.net.URLCodec]
Note: duplicate definition of library class [org.apache.commons.codec.net.RFC1522Codec]
Note: duplicate definition of library class [org.apache.commons.codec.net.BCodec]
Note: duplicate definition of library class [org.apache.commons.codec.net.QCodec]
Note: duplicate definition of library class [org.apache.commons.codec.net.QuotedPrintableCodec]
Note: duplicate definition of library class [android.net.http.SslCertificate$DName]
Note: duplicate definition of library class [android.net.http.SslCertificate]
Note: duplicate definition of library class [android.net.http.HttpResponseCache]
Note: duplicate definition of library class [android.net.http.SslError]

Note: there were 408 duplicate class definitions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)

Initializing...
Note: the configuration refers to the unknown class 'com.android.vending.billing.IInAppBillingService'
Note: the configuration refers to the unknown class 'com.android.vending.billing.IInAppBillingService'
Note: the configuration refers to the unknown class 'com.android.vending.billing.IInAppBillingService'
Note: the configuration refers to the unknown class 'com.android.vending.billing.IInAppBillingService'

Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find superclass or interface javax.servlet.ServletContextListener
Warning: library class android.net.http.AndroidHttpClient extends or implements program class org.apache.http.client.HttpClient
Warning: library class android.net.http.AndroidHttpClientConnection extends or implements program class org.apache.http.HttpInetConnection
Warning: library class android.net.http.AndroidHttpClientConnection extends or implements program class org.apache.http.HttpConnection
Warning: library class com.android.internal.http.multipart.MultipartEntity extends or implements program class org.apache.http.entity.AbstractHttpEntity
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.OkHttpClient
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.OkHttpClient
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.Cache
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: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: org.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.apache.avalon.framework.logger.Logger
Warning: org.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.apache.avalon.framework.logger.Logger
Warning: org.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.apache.avalon.framework.logger.Logger
Warning: org.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.apache.avalon.framework.logger.Logger
Warning: org.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.apache.avalon.framework.logger.Logger
Warning: org.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.apache.avalon.framework.logger.Logger
Warning: org.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.apache.avalon.framework.logger.Logger
Warning: org.apache.commons.logging.impl.AvalonLogger: can't find referenced 
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Category
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Category
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Priority
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Priority
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Priority
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Priority
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Priority
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Logger
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Category
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Category
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Category
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Priority
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Category
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Logger
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Logger
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Priority
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Logger
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Logger
Warning: org.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.apache.log4j.Logger
Warning: org.apache.commons.logging.impl.LogKitLogger: can't find referenced 
Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextListener
Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextEvent
Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextEvent
Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextEvent
Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextEvent
Warning: retrofit2.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

Note: com.google.android.youtube.player.internal.aa: can't find dynamically referenced class com.google.android.youtube.api.locallylinked.LocallyLinkedFactory
Note: com.google.common.util.concurrent.MoreExecutors: can't find dynamically referenced class com.google.appengine.api.ThreadManager
Note: com.google.common.util.concurrent.MoreExecutors: can't find dynamically referenced class com.google.apphosting.api.ApiProxy
Note: com.google.gson.internal.UnsafeAllocator: can't find dynamically referenced class sun.misc.Unsafe
Note: com.google.protobuf.zzc: can't find dynamically referenced class com.google.protobuf.ExtensionRegistry
Note: com.google.protobuf.zzd: can't find dynamically referenced class com.google.protobuf.Extension
Note: com.google.protobuf.zze: can't find dynamically referenced class libcore.io.Memory
Note: com.google.protobuf.zze: can't find dynamically referenced class org.robolectric.Robolectric
Note: com.squareup.picasso.Utils: can't find dynamically referenced class com.squareup.okhttp.OkHttpClient
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.AndroidPlatform$CloseGuard: can't find dynamically referenced class dalvik.system.CloseGuard
Note: okhttp3.internal.platform.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: org.apache.commons.logging.LogSource: can't find dynamically referenced class org.apache.log4j.Logger
Note: org.apache.commons.logging.impl.Log4JLogger: can't find dynamically referenced class org.apache.log4j.Priority
Note: org.apache.commons.logging.impl.Log4JLogger: can't find dynamically referenced class org.apache.log4j.Level
Note: org.apache.commons.logging.impl.Log4JLogger: can't find dynamically referenced class org.apache.log4j.Level

Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpEntity
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.params.HttpParams
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.conn.ClientConnectionManager
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.methods.HttpUriRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpResponse
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.methods.HttpUriRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpResponse
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpHost
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpResponse
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpHost
Warning: library class android.net.http.AndroidHttpClient depends on program 

Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setDefaultAudience(com.facebook.login.DefaultAudience); }', but not the descriptor class 'com.facebook.login.DefaultAudience'
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setLoginBehavior(com.facebook.login.LoginBehavior); }', but not the descriptor class 'com.facebook.login.LoginBehavior'
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setToolTipStyle(com.facebook.login.widget.ToolTipPopup$Style); }', but not the descriptor class 'com.facebook.login.widget.ToolTipPopup$Style'
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setToolTipMode(com.facebook.login.widget.LoginButton$ToolTipMode); }', but not the descriptor class 'com.facebook.login.widget.LoginButton$ToolTipMode'
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setProperties(com.facebook.login.widget.LoginButton$LoginButtonProperties); }', but not the descriptor class 'com.facebook.login.widget.LoginButton$LoginButtonProperties'
Note: the configuration keeps the entry point 'com.facebook.login.widget.LoginButton { void setLoginManager(com.facebook.login.LoginManager); }', but not the descriptor class 'com.facebook.login.LoginManager'
Note: the configuration keeps the entry point 'com.facebook.login.widget.ProfilePictureView { void setOnErrorListener(com.facebook.login.widget.ProfilePictureView$OnErrorListener); }', but not the descriptor class 'com.facebook.login.widget.ProfilePictureView$OnErrorListener'
Note: the configuration keeps the entry point 'com.facebook.share.internal.LikeBoxCountView { void setCaretPosition(com.facebook.share.internal.LikeBoxCountView$LikeBoxCountViewCaretPosition); }', but not the descriptor class 'com.facebook.share.internal.LikeBoxCountView$LikeBoxCountViewCaretPosition'
Note: the configuration keeps the entry point 'com.facebook.share.widget.DeviceShareButton { void setShareContent(com.facebook.share.model.ShareContent); }', but not the descriptor class 'com.facebook.share.model.ShareContent'
Note: the configuration keeps the entry point 'com.facebook.share.widget.LikeView { void setLikeViewStyle(com.facebook.share.widget.LikeView$Style); }', but not the descriptor class 'com.facebook.share.widget.LikeView$Style'
Note: the configuration keeps the entry point 'com.facebook.share.widget.LikeView { void setAuxiliaryViewPosition(com.facebook.share.widget.LikeView$AuxiliaryViewPosition); }', but not the descriptor class 'com.facebook.share.widget.LikeView$AuxiliaryViewPosition'
Note: the configuration keeps the entry point 'com.facebook.share.widget.LikeView { void setHorizontalAlignment(com.facebook.share.widget.LikeView$HorizontalAlignment); }', but not the descriptor class 'com.facebook.share.widget.LikeView$HorizontalAlignment'
Note: the configuration keeps the entry point 'com.facebook.share.widget.LikeView { void setOnErrorListener(com.facebook.share.widget.LikeView$OnErrorListener); }', but not the descriptor class 'com.facebook.share.widget.LikeView$OnErrorListener'
Note: the configuration keeps the entry point 'com.facebook.share.widget.ShareButtonBase { void setShareContent(com.facebook.share.model.ShareContent); }', but not the descriptor class 'com.facebook.share.model.ShareContent'
Note: the configuration keeps the entry point 'com.google.android.gms.flags.impl.FlagProviderImpl { void init(com.google.android.gms.dynamic.IObjectWrapper); }', but not the descriptor class 'com.google.android.gms.dynamic.IObjectWrapper'
Note: the configuration keeps the entry point 'com.google.android.youtube.player.YouTubePlayerView { YouTubePlayerView(android.content.Context,android.util.AttributeSet,int,com.google.android.youtube.player.YouTubePlayerView$b); }', but not the descriptor class 'com.google.android.youtube.player.YouTubePlayerView$b'
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 16 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 17 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 126 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 33 instances of library classes depending on program classes.
         You must avoid such dependencies, since the program classes will
         be processed, while the library classes will remain unchanged.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)

Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForFreeRelease FAILED

这就是发布版本类型:

 release {
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }

现在我在proguard.txt和proguard.pro中添加了一些规则,但有时需要很长时间才能构建并且不会发生。

我需要在哪里正确添加规则以及需要添加的规则是什么?

以下是我的依赖项:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile "com.squareup.picasso:picasso:2.5.2"
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.nononsenseapps:filepicker:4.1.0'
    compile 'com.pes.materialcolorpicker:library:1.2.0'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
    compile 'com.squareup.okhttp3:okhttp:3.3.1'
    compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
    compile 'com.github.myinnos:AwesomeImagePicker:1.0.2'
    compile 'com.android.support:multidex:1.0.1'

    // Dependency for Google Sign-In
    compile 'com.google.android.gms:play-services-auth:11.0.1'

    // Dependencies for the REST API example
    compile 'com.google.api-client:google-api-client:1.22.0'
    compile 'com.google.api-client:google-api-client-android:1.22.0'
    compile 'com.google.apis:google-api-services-people:v1-rev4-1.22.0'

    //Dependency for Facebook Sign-In
    compile 'com.facebook.android:facebook-android-sdk:4.+'

}

3 个答案:

答案 0 :(得分:1)

您可以通过将以下内容添加到build.gradle来告诉gradle不允许重复的类(仅采用第一个类):

jar {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

答案 1 :(得分:1)

如果有人像我一样努力让它发挥作用,那么就找到解决方案。

将此添加到您的proguard.pro文件

-dontwarn org.apache.commons.**
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}

答案 2 :(得分:0)

就我而言,将其添加到构建文件后,问题得以解决:

configurations {
    all {
        exclude module: 'httpclient'
    }
}

并保护配置:

-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
-keep class * extends com.google.api.client.json.GenericJson {
*;
}
-keep class com.google.api.services.drive.** {
*;
}