JWTDecode.Android
JWTDecode.Android copied to clipboard
Gson R8 proguard rules (java.lang.runtimeexception: missing type parameter.)
Checklist
- [X] I have looked into the Readme and Examples, and have not found a suitable solution or answer.
- [X] I have looked into the API documentation and have not found a suitable solution or answer.
- [X] I have searched the issues and have not found a suitable solution or answer.
- [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the Auth0 Code of Conduct.
Description
I was using val jwt = JWT(tokenId)
to retrieve claims from the tokenId, in the release build of my android studio project, along with R8 enabled. However I've received the following error: java.lang.runtimeexception: missing type parameter.
After adding those three lines of code in the proguard-rules.pro
, the error disappeared:
-keep class com.google.gson.reflect.TypeToken
-keep class * extends com.google.gson.reflect.TypeToken
-keep public class * implements java.lang.reflect.Type
I also had to manually add Gson library to my project just to add those rules, since I'm using KotlinX Serialization library. Is there a way for you to add those rules for Gson, when using R8, so that we don't have to?
Reproduction
- Enable R8
- Retrieve claims from a tokenId with
val jwt = JWT(tokenId)
Additional context
No response
JWTDecode.Android version
2.0.2
Android version(s)
33