Android studio: NoClassDefFoundError with java.util.Base64

孤街浪徒 提交于 2020-05-10 14:46:49

问题


Apologies, I've scanned the many similar-sounding questions and none of them have helped me.

I'm running Android Studio 3.0.1, I'm a newbie, I'm following the online tutorial "HelloWorld" program but then adding a call to java.util.Base64.getDecoder(). This fails at runtime when I run it on my actual phone (Samsung Galaxy S8):

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

               Caused by: java.lang.ClassNotFoundException: Didn't find class "java.util.Base64" on path: DexPathList[[zip file "/data/app/com.skedgo.helloworld-1/base.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.skedgo.helloworld-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.skedgo.helloworld-1/lib/arm64, /system/lib64, /vendor/lib64]]

I have in AndroidManifest.xml:

<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27"/>

I have: Compile SDK Version: API 26: Android 8.0 (Oreo)

How can I solve this problem?

I was under the belief that "java.util.Base64" was part of the standard Java library, at least for the version I'm using, so I shouldn't need to do anything special to use it. I don't know anything about Gradle but I know that I'm using it.


回答1:


have you tried android.util.Base64? android doesn't use openjdk or oracle jre so the standard packages may not be there.



来源:https://stackoverflow.com/questions/48697766/android-studio-noclassdeffounderror-with-java-util-base64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!