gpt4 book ai didi

android - 应用程序 :transformClassesAndResourcesWithProguardForRelease

转载 作者:太空狗 更新时间:2023-10-29 16:32:18 25 4
gpt4 key购买 nike

Error:Execution failed for task 
':app:transformClassesAndResourcesWithProguardForRelease'.

java.io.IOException: Please correct the above warnings first.

我已经尽力找到解决方案,但我没有得到,但我发现了很多问题。

有什么可以忽略这些警告的吗,我只想生成一个安全签名的apk,因此我使用了minifyEnabled true

留言:

Warning:retrofit.client.OkClient$1: can't find superclass or interface com.squareup.okhttp.RequestBody
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Call
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Call
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Response
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.Cache
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchServiceFactory
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
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: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.HTTPResponse
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.HTTPResponse
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
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.HTTPResponse
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchServiceFactory
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
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.HTTPResponse
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
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.HTTPResponse
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
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.HTTPMethod
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.HTTPResponse
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:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
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:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Call
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Response
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Response
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Headers
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Call
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Response
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Headers
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Request$Builder
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Response
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.RequestBody
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.MediaType
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.Headers
Warning:retrofit.client.OkClient$1: can't find referenced class com.squareup.okhttp.RequestBody
Warning:retrofit.client.OkClient$1: can't find referenced class okio.BufferedSink
Warning:retrofit.client.OkClient$1: can't find referenced class com.squareup.okhttp.RequestBody
Warning:retrofit.client.OkClient$1: can't find referenced class okio.BufferedSink
Warning:retrofit.client.OkClient$1: can't find referenced class com.squareup.okhttp.MediaType
Warning:retrofit.client.OkClient$1: can't find referenced class okio.BufferedSink
Warning:retrofit.client.OkClient$2: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:retrofit.client.OkClient$2: can't find referenced class com.squareup.okhttp.MediaType
Warning:retrofit.client.OkClient$2: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:retrofit.client.OkClient$2: can't find referenced class com.squareup.okhttp.MediaType
Warning:retrofit.client.OkClient$2: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:retrofit.client.OkClient$2: can't find referenced class com.squareup.okhttp.MediaType
Warning:retrofit.client.OkClient$2: can't find referenced class com.squareup.okhttp.ResponseBody
Warning:retrofit.client.OkClient$2: can't find referenced class com.squareup.okhttp.MediaType
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.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.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

最佳答案

当您使用 ProGuard 时,您必须始终解决所有警告,以便能够进一步处理构建。

这些警告告诉您这些库引用了一些代码,但没有这些代码的来源。那可能会也可能不会。这取决于是否调用了有问题的代码。

在这种情况下,库引用了一些代码,但代码似乎从未被调用过(例如,因为您没有添加其他库)。在这种情况下,将 -dontwarn 规则添加到 proguard-rules.pro 文件。

您使用 Retrofit 和 Picasso 库。尝试添加这些规则:

-dontwarn okio.**
-dontwarn retrofit.**
-keep class retrofit.** { *; }
-keepclassmembers,allowobfuscation interface * {
@retrofit.http.** <methods>;
}

-dontwarn com.squareup.okhttp.**

它可能会解决您的问题。

请注意,您可能会在运行时遇到更多问题,尤其是当这些库中的任何一个使用反射并且代码被压缩和/或混淆时。那么您可能需要更多用于其他库的 ProGuard 规则。

编辑:要解决与 RxJava 相关的警告,请添加此依赖项:

// ProGuard rules for RxJava
compile 'com.artemzin.rxjava:proguard-rules:1.1.1.0'

它为 RxJava 添加了必要的 ProGuard 规则。

关于android - 应用程序 :transformClassesAndResourcesWithProguardForRelease,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35767565/

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