Warning:io.jsonwebtoken.impl.crypto.EllipticCurveProvider: 找不到引用 class org.bouncycastle.jce.ECNamedCurveTable

Warning:io.jsonwebtoken.impl.crypto.EllipticCurveProvider: can't find referenced class org.bouncycastle.jce.ECNamedCurveTable

我无法使用 json 网络令牌和 proguard

生成我签名的 apk
Gradle tasks [:app:assembleRelease]
io.jsonwebtoken.impl.crypto.EllipticCurveProvider: can't find referenced class org.bouncycastle.jce.ECNamedCurveTable there were 2 unresolved references to classes or interfaces.
Exception while processing task javaio.10Exception: Please correct the above warnings first.
Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
BUILD FAILED
Total time: 9.255 secs
1 error
3 warnings
See complete output in console

来自 this issue,将以下规则添加到您的 proguard-rules.pro 文件中:

-keepnames class com.fasterxml.jackson.databind.** { *; }
-dontwarn com.fasterxml.jackson.databind.*
-keepattributes InnerClasses

-keep class org.bouncycastle.** { *; }
-keepnames class org.bouncycastle.* { *; }
-dontwarn org.bouncycastle.*

-keep class io.jsonwebtoken.** { *; }
-keepnames class io.jsonwebtoken.* { *; }
-keepnames interface io.jsonwebtoken.* { *; }

-dontwarn javax.xml.bind.DatatypeConverter
-dontwarn io.jsonwebtoken.impl.Base64Codec

-keepnames class com.fasterxml.jackson.** { * ; }
-keepnames interface com.fasterxml.jackson.** { *; }