当前位置: 首页 > 知识库问答 >
问题:

获取com。洛普。Androidhttp。启用Proguard后的AsyncHttpClient

洪胤
2023-03-14

我读过这篇文章,这似乎是很久以前就知道的问题了。但当我没有使用pro-guard时,我没有收到任何警告或崩溃。启用后,我收到大约500条警告,如下所示:;

警告:com.loopj.android.http.AsyncHttpClient:找不到引用的类cz.msebera.android.httpclient

我试着跟踪,但所有的警告仍然存在。

android {

    compileSdkVersion 24
    buildToolsVersion "24.0.3"
    useLibrary 'org.apache.http.legacy'

}

我没有使用http客户端库,但我在项目中使用的其他库可能正在使用它。

警告

Warning:com.loopj.android.http.RangeFileAsyncHttpResponseHandler: can't find referenced class cz.msebera.android.httpclient.HttpResponse
Warning:com.loopj.android.http.RangeFileAsyncHttpResponseHandler: can't find referenced class cz.msebera.android.httpclient.Header
Warning:com.loopj.android.http.RangeFileAsyncHttpResponseHandler: can't find referenced class cz.msebera.android.httpclient.StatusLine
Warning:com.loopj.android.http.RangeFileAsyncHttpResponseHandler: can't find referenced class cz.msebera.android.httpclient.HttpResponse
Warning:com.loopj.android.http.RangeFileAsyncHttpResponseHandler: can't find referenced class cz.msebera.android.httpclient.HttpEntity
Warning:com.loopj.android.http.RangeFileAsyncHttpResponseHandler: can't find referenced class cz.msebera.android.httpclient.client.methods.HttpUriRequest
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.protocol.HTTP
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.message.BasicNameValuePair
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.client.entity.UrlEncodedFormEntity
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.message.BasicNameValuePair
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.client.utils.URLEncodedUtils
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.message.BasicNameValuePair
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.client.utils.URLEncodedUtils
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.message.BasicNameValuePair
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.HttpEntity
Warning:com.loopj.android.http.RequestParams: can't find referenced class cz.msebera.android.httpclient.message.BasicNameValuePair


Warning:rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.ConcurrentCircularArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.ConcurrentSequencedCircularArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.MpmcArrayQueueConsumerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.MpmcArrayQueueProducerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.MpscLinkedQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpmcArrayQueueConsumerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpmcArrayQueueProducerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpscArrayQueue: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpscArrayQueueConsumerField: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.SpscArrayQueueProducerFields: can't find referenced class sun.misc.Unsafe
Warning:rx.internal.util.unsafe.UnsafeAccess: can't find referenced class sun.misc.Unsafe
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
Warning:library class org.apache.http.conn.ssl.SSLSocketFactory depends on program class org.apache.http.conn.scheme.HostNameResolver
Warning:library class org.apache.http.conn.ssl.SSLSocketFactory depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.params.HttpConnectionParams depends on program class org.apache.http.params.HttpParams
Warning:there were 757 unresolved references to classes or interfaces.
Warning:there were 18 instances of library classes depending on program classes.
Warning:there were 8 unresolved references to program class members.
Warning:there were 2 unresolved references to library class members.

在添加了Hitesh Gehlot答案中提供的行之后。我收到了这5个警告。

Information:Gradle tasks [:app:assembleRelease]
Warning:com.algolia.search.saas.APIClient: can't find referenced method 'org.json.JSONObject put(java.lang.String,java.util.Collection)' in library class org.json.JSONObject
Warning:com.algolia.search.saas.Index: can't find referenced method 'org.json.JSONObject put(java.lang.String,java.util.Collection)' in library class org.json.JSONObject
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
Warning:there were 3 instances of library classes depending on program classes.
Warning:there were 2 unresolved references to library class members.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.

共有1个答案

钮瀚
2023-03-14

将这些行粘贴到proguard规则中。专业文件

-dontwarn com.loopj.android.http.**
-dontwarn org.apache.http.**
-dontwarn rx.internal.util.**
 类似资料:
  • 我得到以下错误: 找不到[Android/view/view](有2个已知超级类)和[com/rey/Material/widget/listpopupwindow$DropDownListView](有2个已知超级类)的通用超级类

  • 我得到一个例外: 原因:java。lang.ClassNotFoundException:未找到类“io.realm.realm” 内置的。gradle minifyEnabled为真。 前进的规则。赞成的意见: 保持类io.realm.annotations.RealmMoules -保持@io。领域注释。RealmModule类* -保持课堂秩序。领域内部的保持 -保持@io。领域内部的上课*

  • 问题内容: 每次我从Eclipse导出签名应用程序并将apk文件安装到手机上时,该应用程序都会崩溃。这仅在启用Proguard的情况下发生。 这是我的保护文件 我运行了adb logcat命令来检查崩溃报告。以下是我认为很重要的报告摘要: 第二段: 如果有人可以帮助我,我将非常感谢并接受您的回答。 更新: 所以我将这些添加到我的proguard文件中 现在启用Proguard时出现与Jackson

  • 在发布模式下,当我只启用multi-dex时,我的应用程序大小为33.30MB,这相当大。经过一系列的研究,我意识到PROGUARD缩小了apk的大小。在我的解决方案中启用proguard,会出现此错误。PROGUARD的解决方案中可能缺少什么(缩小我的应用程序大小)? proguard.cfg

  • 我正在工作xamarin应用程序。当我启用"ProGuard"在Android属性,而建立的应用程序,我得到以下错误: 开发环境: Visual Studio 2015 Xamarin 4.0。4.4

  • 10mins左右 线上 1.自我介绍 2.项目介绍和负责的工作 3.简历细节确认 4.公众号更多还是短视频更多 5.数据分析和涨粉的关系 6.是否投豆荚 7.发一下作品集 8.反问 面试体验有点迷迷,可能和企业性质有关,面试业务部门的专业水平未知。 同时,面试官也迟到了一会,好像这个面试有一些微妙的尴尬。