gpt4 book ai didi

android - "minifyEnabled true"给我带来了问题,为什么会这样?

转载 作者:行者123 更新时间:2023-11-29 19:09:39 28 4
gpt4 key购买 nike

当我在任何变体(调试或发布)中将 minifiyEnabled 设置为 true 时,它​​会给出以下错误 -

Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader
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 176 unresolved references to classes or interfaces.
Warning:there were 23 instances of library classes depending on program classes.
Warning:there were 6 unresolved references to program class members.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForProductionDebug'.
> Job failed, see logs for details

如果是 Lolipop 或更高版本,它可以在模拟器或设备中正常工作。

如果我禁用或将 minifyEnabled 设置为 false,我的问题就解决了,但我真的不想这样。

我的gradle工具是build:gradle:2.3.0'

multiDexEnabled true

注意 - 我没有在我的 proguard-rules.pro 文件中保留任何类或属性。

最佳答案

经过大量的研究和实验,我找到了解决方案。我们必须在 proguard-rules.pro 文件中添加 keepdontwarn 语句 -

# Retrofit 1.X
-keep class com.squareup.okhttp.** { *; }
-keep class retrofit.** { *; }
-keep interface com.squareup.okhttp.** { *; }

-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
-dontwarn retrofit.**
-dontwarn rx.**

-keepclasseswithmembers class * {
@retrofit.http.* <methods>;
}

# If in your rest service interface you use methods with Callback argument.
-keepattributes Exceptions

# If your rest service methods throw custom exceptions, because you've defined an ErrorHandler.
-keepattributes Signature



# Proguard configuration for amazon Jackson 2.x (fasterxml package instead of codehaus package)

-keep class com.amazonaws.** { *; }
-keepnames class com.amazonaws.** { *; }
-dontwarn com.amazonaws.**
-dontwarn com.fasterxml.**


-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**

-dontwarn org.mockito.**
-dontwarn sun.reflect.**
-dontwarn android.test.**



-dontwarn org.hamcrest.**
-dontwarn android.test.**
-dontwarn android.support.test.**

-keep class org.hamcrest.** {
*;
}

-keep class org.junit.** { *; }
-dontwarn org.junit.**

-keep class junit.** { *; }
-dontwarn junit.**

-keep class sun.misc.** { *; }
-dontwarn sun.misc.**


-keep public class android.net.http.SslError
-keep public class android.webkit.WebViewClient

-dontwarn android.webkit.WebView
-dontwarn android.net.http.SslError
-dontwarn android.webkit.WebViewClient


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

注意 - 我按照消息中的警告进行操作,并通过一一选择来相应地放置我的 proguard 规则。

关于android - "minifyEnabled true"给我带来了问题,为什么会这样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45814320/

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