- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
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/
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. java.io.I
我正在尝试在控制台中使用 Gradle 构建我的 Android 应用程序。但是收到关于任务':app:transformClassesAndResourcesWithProguardForRelea
在为我的发行版启用缩小功能时,出现以下错误。 Error:Execution failed for task ':app:transformClassesAndResourcesWithProguar
生成签名的 APK: Note: there were 8 unresolved dynamic references to classes or interfaces. Note: there we
我最近将 android studio 更新到 2.3 版,将构建工具更新到 25.0.2、gradle 2.3.0 和 gradle distribution 3.3,现在我在构建项目时得到了这个。
您好,我正在努力为我的项目创建发布版本。我已经通过 SO/Google 帮助在 Progaurd 上尝试了很多东西,但我仍然无法创建发布版本。 有人可以帮我解决这个问题吗?我总是遇到这个问题: Err
我正在尝试导出 apk,我想启用 Proguard,但它抛出了错误。我阅读了很多答案并尝试了但没有奏效。出现以下错误: Warning:Exception while processing task
我正在 Android 中构建一个应用程序,这是 build.gradle 文件: apply plugin: 'com.android.application' android { comp
当我尝试使用发布构建变体构建我的项目时,我收到一个错误: Information:Gradle tasks [:app:assembleRelease] :app:preBuild UP-TO-DAT
当我尝试在 Android Studio 中生成签名时,出现以下错误: Error:Execution failed for task ':app:transformClassesAndResourc
我刚刚将我的项目迁移到 gradle-experimental:0.4.0 以使用 JNI。我已按照说明 here 该项目由一个库和一个应用程序组成。我无法绕过这个错误(尝试了通常的清理和无效缓存/重
我在 React Native 中开发了我的应用程序。我想缩小和缩小我的代码。为了实现这一点,我启用了 proguard 并在 build.gradle 中添加了基于 proguard 的行 这是我的
我正在尝试签署我的应用程序以供发布并且它构建正确,但我想启用 Proguard 我收到以下错误 Error:Execution failed for task ':app:transformClass
每次我在运行我的项目时遇到这个错误。我可以做一个清洁然后再次运行,它可以工作。但这不是最佳解决方案。有什么想法吗? Error:Execution failed for task ':android:
我刚刚更新到 Android Studio 2.1.1,我正在尝试构建一个发布签名的 apk,但失败并出现以下错误。我该如何解决这个问题? ':app:transformClassesAndResou
我是使用混淆器的新手,当我在创建已签名的 api 后构建 api 时,我收到了这些警告和异常。我不知道如何解决它。 这是错误日志: Warning:okio.DeflaterSink: can't f
我正在尝试生成我的 android 应用程序的签名 apk,但任务仍然不成功,给我这个错误: Information:Gradle tasks [:app:assembleRelease] Warni
我已经为我的 Android 应用程序生成了一个 APK(作为尝试),我没有遇到任何问题,APK 已正确生成。 现在,我想在生成 APK 时混淆我的代码,所以我在 build.gradle 文件的 r
当我尝试在 android studio 1.5.1 中生成签名的 Apk 并完成有关此过程的对话框时,我遇到了此消息并中止了构建: Warning:com.squareup.picasso.
我是一名优秀的程序员,十分优秀!