В кодах нет ничего плохого, поэтому я просто копирую ошибку.я использую okhttp 3.12.0, чтобы получить что-то из Интернета (в программировании на Android)
следующая строка, вероятно, является основной проблемой:
java.lang.ClassNotFoundException: Didn't find class "kotlin.text.Charsets"
или
AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.example.infitualer.ipdemo, PID: 3306
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:325)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/text/Charsets;
at okio.Buffer.<clinit>(Buffer.kt:2212)
at okhttp3.ResponseBody.create(ResponseBody.java:210)
at okhttp3.internal.Util.<clinit>(Util.java:62)
at okhttp3.internal.Util.immutableList(Util.java:0)
at okhttp3.OkHttpClient.<clinit>(OkHttpClient.java:127)
at com.example.infitualer.ipdemo.MainActivity$IpTask.doInBackground(MainActivity.java:34)
at com.example.infitualer.ipdemo.MainActivity$IpTask.doInBackground(MainActivity.java:25)
at android.os.AsyncTask$2.call(AsyncTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.text.Charsets" on path: DexPathList[[zip file "/data/app/com.example.infitualer.ipdemo-1/base.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.infitualer.ipdemo-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.infitualer.ipdemo-1/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at okio.Buffer.<clinit>(Buffer.kt:2212)
at okhttp3.ResponseBody.create(ResponseBody.java:210)
at okhttp3.internal.Util.<clinit>(Util.java:62)
at okhttp3.internal.Util.immutableList(Util.java:0)
at okhttp3.OkHttpClient.<clinit>(OkHttpClient.java:127)
at com.example.infitualer.ipdemo.MainActivity$IpTask.doInBackground(MainActivity.java:34)
at com.example.infitualer.ipdemo.MainActivity$IpTask.doInBackground(MainActivity.java:25)
at android.os.AsyncTask$2.call(AsyncTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)