instagram4j / instagram4j

:camera: Instagram private API in Java
Apache License 2.0
915 stars 274 forks source link

java.lang.NoClassDefFoundError: Failed resolution of: Ljava/util/Base64; #632

Open hims1008 opened 2 years ago

hims1008 commented 2 years ago

i try this dependency for get feed data of Instagram but error occur in login method and error is

  com.github.instagram4j.instagram4j.exceptions.IGLoginException: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/util/Base64;
    at com.github.instagram4j.instagram4j.IGClient$Builder.performLogin(IGClient.java:278)
    at com.github.instagram4j.instagram4j.IGClient$Builder.login(IGClient.java:255)

i also add this in build.gradle

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
ErrorxCode commented 2 years ago

Actually, java.lang.Base64 class is not available on some android emulators. For that, we have to use the android.utils.Base64 class. But there's a catch, If developers use android.utils.Base64 then the same error will occur in Non-Android projects

lyg73 commented 2 years ago

Can you use org.apache.commons.codec.binary.Base64 or other base64 package for Base64 functions instad of java.lang.Base64?