【问题标题】:Android proguard rule gives error with twilio client sdkAndroid proguard 规则导致 twilio 客户端 sdk 出错
【发布时间】:2017-01-10 08:11:08
【问题描述】:

我添加了具有以下 proguard 规则的 Twilio 客户端 SDK

 # 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

【问题讨论】:

    标签: android gradle twilio proguard


    【解决方案1】:
    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
    

    要解决内部类问题,请将其添加到您的 proguard 文件中:

    -keepattributes EnclosingMethod
    

    【讨论】:

    • 您能简单介绍一下解决方案吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-04
    • 2020-11-11
    • 1970-01-01
    • 2015-09-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多