简体   繁体   English

启用Proguard后获取com.loopj.android.http.AsyncHttpClient

[英]Getting com.loopj.android.http.AsyncHttpClient after enabling Proguard

I have read this , It looks like its a known issue from quite some time. 我已经读过这篇文章 ,一段时间以来它似乎是一个已知问题。 But i was not receiving any warning or crash when i was not using pro-guard . 但是当我不使用pro-guard时,我没有收到任何警告或崩溃。 After enabling it, I am receiving around 500 warnings like following; 启用它后,我将收到大约500条如下警告:

Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class cz.msebera.android.httpclient 警告:com.loopj.android.http.AsyncHttpClient:找不到引用的类cz.msebera.android.httpclient

I have tried following, but still all of the warnings are there. 我尝试了以下操作,但是所有警告仍然存在。

android {

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

}

I am not using http-client library, but there may be some other library that I am using in my project is using this. 我没有使用http-client库,但是在我的项目中可能正在使用其他库。

Warnings 警告事项

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.

After adding the lines provided in Hitesh Gehlot answer. 在添加Hitesh Gehlot中提供的行后,答案。 I am receiving these 5 warnings. 我收到这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.

paste these lines in proguard-rules.pro file 将这些行粘贴到proguard-rules.pro文件中

-dontwarn com.loopj.android.http.**
-dontwarn org.apache.http.**
-dontwarn rx.internal.util.**

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到类:com.loopj.android.http.AsyncHttpClient - Class not found : com.loopj.android.http.AsyncHttpClient 程序类型已存在:com.loopj.android.http.AsyncHttpClient$3 - Program type already present: com.loopj.android.http.AsyncHttpClient$3 (Android)找不到com.loopj.android.http.AsyncHttpClient的类定义错误 - (Android) No Class Def Found Error for com.loopj.android.http.AsyncHttpClient 获得Pro-guard后无法找到[com / loopj / android / http / MySSLSocketFactory]的常见超类 - Getting Can't find common super class of [com/loopj/android/http/MySSLSocketFactory] after enabling Pro-guard Android:Loopj AsyncHttpClient获取HTTP错误代码 - Android: Loopj AsyncHttpClient Get HTTP Error Code 在Android中使用loopj AsyncHttpClient上传后,图片大小已更改 - image size changed after uploading with loopj AsyncHttpClient in Android Android loopj asynchttpclient返回响应 - Android loopj asynchttpclient return response Android:启用proguard org.apache.http后无法正常工作 - Android : After enabling proguard org.apache.http is not working 使用loopj AsyncHttpClient获取SocketTimeoutExceptions。 - Getting SocketTimeoutExceptions using loopj AsyncHttpClient. Loopj AsyncHttpClient JsonHttpResponseHandler没有收到超时异常 - Loopj AsyncHttpClient JsonHttpResponseHandler not getting a timeout exception
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM