-
Notifications
You must be signed in to change notification settings - Fork 29
Description
With the dependency update of commons-codec:commons-codec:15.0 to any newer version, introduced with Passman Android v1.5.0 to usage of Base32().decode causes an java.lang.NoSuchMethodError.
It seems the BinaryCodec class, needed by org.apache.commons.codec.binary.Base32 for the OTP code generator is being loaded from the Android system and not from our provided commons-codec:1.18.0 dependency.
That causes this weird errors:
java.lang.NoSuchMethodError: No static method isEmpty([B)Z in class Lorg/apache/commons/codec/binary/BinaryCodec; or its super classes (declaration of 'org.apache.commons.codec.binary.BinaryCodec' appears in /system/framework/ext.jar)
java.lang.NoSuchMethodError: No static method isEmpty([B)Z in class Lorg/apache/commons/codec/binary/BinaryCodec; or its super classes (declaration of 'org.apache.commons.codec.binary.BinaryCodec' appears in /system/framework/org.apache.http.legacy.boot.jar)
Interpretation: the android system’s used old BinaryCodec version doesn’t have newer methods like isEmpty() which is needed by our used commons-codec:1.18.0 (problem appears for every version > 1.15 with API < 28)
Unfortunately it seems that Android’s classloader hierarchy always prioritizes the system class of "org.apache.commons.codec.binary.BinaryCodec", but does not replace the "org.apache.commons.codec.binary.BaseNCodec" class which tries to use the "BinaryCodec.isEmpty(pArray)" call.
Could be the same problem like here:
- https://programmerah.com/java-and-android-commons-codec-usage-and-nosuch-method-error-224/
- SDK jar not compatible with old Android Runtimes algorand/java-algorand-sdk#271
Solutions:
- option 1: use another lib für base32 decoding (like bouncycastle or guava)
- would require min sdk 26, maybe higher (we have 21 atm.)
- option 2: stay with the current lib and drop support for old apis
- we need to set min sdk 28 (=android 9.0)
- option 3: Shade (Relocate) the Library -> heavy shit (I don't want to maintain / take care of that)
- my preferred option 4: use standalone Base32 decoding source code directly within the project