0
votes

With io.ktor:ktor-auth:1.5.2 on minSdkVersion 25 I get "Cannot access class 'com.google.common.util.concurrent.ListenableFuture'" when attempting to build the project and after adding implementation 'com.google.guava:guava:27.0.1-android' to build.gradle it worked again, like it was suggested here.

However, when I attempt to generate a JWT token the JWTCreator.Builder.sign() method uses Base64.encodeBase64URLSafeString() from org.apache.commons.codec.binary.Base64 and I get the following error:

java.lang.NoSuchMethodError: No static method encodeBase64URLSafeString([B)Ljava/lang/String; in class Lorg/apache/commons/codec/binary/Base64; or its super classes (declaration of 'org.apache.commons.codec.binary.Base64' appears in /system/framework/org.apache.http.legacy.boot.jar)

Is there something I can do apart from manually overriding the entire Ktor class (which might not even be possible)? Note that I've already added implementation 'commons-codec:commons-codec:1.15' but nothing changed.

1

1 Answers

0
votes

Use JWTDecode.Android for Android (even with Kotlin):

implementation "com.auth0.android:jwtdecode:2.0.0"