gpt4 book ai didi

java - 带有 sdk 23 和 proguard 的 Apache HTTP 客户端

转载 作者:太空狗 更新时间:2023-10-29 14:53:49 27 4
gpt4 key购买 nike

现在很多库要求 compileSdkVersion 23。但是这个版本不包含 apache,一些旧库使用 apache http。为了将 apache 与 23 一起使用,我找到了解决方案,其中提到将 org.apache.http.legacy 添加到 grudle。
useLibrary 'org.apache.http.legacy'

这项工作。但不是proguard。我使用 proguard 来缩小 apk 大小,我没有使用混淆,只有 minifyEnabled true在“proguard-rules.txt”中我只有一个字符串:
-dontobfuscate
当我构建 apk AndroidStudio 时显示错误,因为某些库使用了 apache。我试图将保留类添加到混淆器中,但这不起作用。每次我收到关于 apache 的错误。

-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**

-keep class android.net.http.** { *; }
-dontwarn android.net.http.**

-keep class android.support.v7.** { *; }
-keep class android.support.v4.** { *; }

注意:当 proguard 被禁用时(minifyEnabled 设置为 false)然后 apk 构建和工作成功。这是来自 android studio 控制台的错误示例:

:app:proguardRelease
Warning: com.vk.sdk.api.httpClient.VKHttpOperation: can't find referenced method 'org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest)' in program class com.vk.sdk.api.httpClient.VKHttpClient
Warning: org.acra.ErrorReporter: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification

还有更多

Warning: com.mopub.mobileads.VastVideoViewController: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning: com.mopub.mobileads.VastVideoViewController: can't find referenced class org.apache.http.client.methods.HttpGet
Warning: com.mopub.mobileads.factories.HttpClientFactory: can't find referenced class org.apache.http.params.BasicHttpParams
Warning: com.mopub.mobileads.factories.HttpClientFactory: can't find referenced class org.apache.http.params.BasicHttpParams
Warning: com.mopub.mobileads.factories.HttpClientFactory: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning: com.mopub.mobileads.factories.HttpClientFactory: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning: com.mopub.mobileads.factories.HttpClientFactory: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning: com.mopub.mobileads.factories.HttpClientFactory: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning: com.mopub.mobileads.factories.HttpClientFactory: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning: com.mopub.mobileads.util.HttpClients: can't find referenced class org.apache.http.client.HttpClient
Warning: com.mopub.mobileads.util.HttpClients: can't find referenced class org.apache.http.client.HttpClient
Warning: com.mopub.mobileads.util.HttpClients$1: can't find referenced class org.apache.http.client.HttpClient
Warning: com.mopub.mobileads.util.HttpClients$1: can't find referenced class org.apache.http.client.HttpClient
Warning: com.mopub.mobileads.util.HttpClients$1: can't find referenced class org.apache.http.conn.ClientConnectionManager
Warning: com.mopub.mobileads.util.HttpClients$1: can't find referenced class org.apache.http.conn.ClientConnectionManager
Warning: com.mopub.mobileads.util.HttpClients$1: can't find referenced class org.apache.http.client.HttpClient
Warning: com.mopub.mobileads.util.HttpClients$1: can't find referenced class org.apache.http.client.HttpClient
Warning: com.mopub.mobileads.util.vast.VastXmlManagerAggregator: can't find referenced class android.net.http.AndroidHttpClient

最佳答案

我刚遇到同样的问题,并通过以下方式解决了:

  • 将 Android SDK 构建工具更新到 23.0.1

  • 将 MoPub 更新到 3.13.0

关于java - 带有 sdk 23 和 proguard 的 Apache HTTP 客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33069931/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com