Reputation: 948
Using third party JAVA jar file for Android application, it has dependency on 'java.util.Base64'. So here I can not use 'android.util.Base64'.
While running the app I am getting the below exception:
java.lang.ClassNotFoundException: Didn't find class "java.util.Base64"
As per some of the stack overflow solution, we should add this dependency in android gradle
implementation "commons-codec:commons-codec:1.10"
But still the app is crashing with same exception.
Upvotes: 1
Views: 1449
Reputation: 1794
https://developer.android.com/reference/java/util/Base64 says Base64
is "Added in API level 26". So if your phone is older than Android 8.0 Oreo, Android won't be able to find that class.
If you want to use the Base64
class from Apache commons (the commons-codec import you listed), make sure you import org.apache.commons.codec.binary.Base64
instead. Note the API for those two classes are not exactly the same.
Upvotes: 3