Android proguard规则给twilio客户端sdk带来错误

时间:2017-01-10 08:11:09

标签: android gradle twilio proguard

我添加了Twilio客户端SDK以及以下proguard规则

 # Twilio Client
 -keep class com.twilio.** { *; }
 # Apache HttpClient
-dontwarn org.apache.http.**
-keepattributes InnerClasses

添加后,我收到以下错误消息

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:there were 3 instances of library classes depending on program classes.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.

为了抑制错误,我添加了这些规则

-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

当我执行上述操作时,我会收到这些错误

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(android.support.design.widget.o) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler

打破了apk版本。任何形式的帮助将不胜感激。 TIA

1 个答案:

答案 0 :(得分:2)

-keepattributes EnclosingMethod

要解决内部类问题,请在proguard文件中添加:

{{1}}