Proguard的不再与改造工程 [英] Proguard no longer works with Retrofit
问题描述
我发现旧的问题,它触及了相同的问题,但与最新的版本没有可用的答案为我工作。
I have found older questions which touch on the same subject but with the latest versions none of the available answers work for me.
我使用的改造在我的项目。当我尝试组装我得到以下错误:
I am using Retrofit in my project. When I try to assemble I get the following error:
警告:retrofit.client.OkClient:找不到引用的类com.squareup.okhttp.OkHttpClient
Warning: retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.OkHttpClient
我用下面的,但它都没有帮助:
I'm using the following but none of it is helping:
-keepattributes Signature
-keep class retrofit.** { *; }
-keep class retrofit.http.** { *; }
-keep class retrofit.client.** { *; }
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-keep class com.google.gson.** { *; }
-keep class com.google.inject.* { *; }
-keep class org.apache.http.* { *; }
-keep class org.codehaus.mojo.** { *; }
-keep class org.apache.james.mime4j.* { *; }
-keep class javax.inject.* { *; }
-keep class sun.misc.Unsafe { *; }
-libraryjars libs/acra-4.5.0.jar
-libraryjars libs/radial-menu-v4.jar
-dontwarn javax.xml.stream.events.**
-dontwarn rx.**
-dontwarn org.apache.lang.**
# Application classes that will be serialized/deserialized over Gson
-keep class com.example.package.network.** { *; }
有没有人有这个问题,最近并解决它?
Has anybody had this issue recently and resolved it?
推荐答案
看起来微不足道,但你尝试过包括这条线? (如果你不使用okhttp即是)。
Might seem trivial, but have you tried including this line? (If you don't use okhttp that is).
-dontwarn com.squareup.okhttp.**
事情是方不使用Proguard的内部,因此,虽然他们的图书馆可能会做出什么正在使用的一些假设,你可以放心地忽略它,如果你的项目没有使用它。我有同样的问题,毕加索和这个固定为我。
Thing is Square doesn't use Proguard internally, so while their libraries may make some assumptions of what's being used, you can safely ignore it if your project doesn't use it. I had the same issue with Picasso and this fixed it for me.
这篇关于Proguard的不再与改造工程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!