org.apache.http.legacy.jar Proguard错误 [英] org.apache.http.legacy.jar Proguard error

查看:154
本文介绍了org.apache.http.legacy.jar Proguard错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用httpclient-4.5.2.jar + httpcore-4.4.4.jar时,Proguard可以正常工作.但是,当我用org.apache.http.legacy.jar替换上面的软件包时,报告了以下Proguard错误:

When I use httpclient-4.5.2.jar + httpcore-4.4.4.jar, Proguard works fine. But when I replace the above to packages by org.apache.http.legacy.jar, following Proguard error is reported:

Proguard returned with error code 1. See console
Note: there were 273 duplicate class definitions.
Warning: library class android.webkit.WebView depends on program class android.net.http.SslCertificate
Warning: library class android.webkit.WebView depends on program class android.net.http.SslCertificate
Warning: library class android.webkit.WebViewClient depends on program class android.net.http.SslError
      You should check if you need to specify additional program jars.
Warning: there were 3 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.
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:321)
    at proguard.ProGuard.initialize(ProGuard.java:211)
    at proguard.ProGuard.execute(ProGuard.java:86)
    at proguard.ProGuard.main(ProGuard.java:492)

我该如何解决?

推荐答案

使用下面的代码到您的build.gradle中,而不是导入jar文件:

use this below code into your build.gradle instead import jar file :

useLibrary 'org.apache.http.legacy'

作为参考,请检查此代码:

For reference check this code :

android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
useLibrary 'org.apache.http.legacy'

defaultConfig {
    applicationId "com.application.abc"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

这篇关于org.apache.http.legacy.jar Proguard错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆