Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Didn't find class "kotlinx.serialization.json.Json" on path: DexPathList #2736

Open
ravadisagarrao opened this issue Jul 2, 2024 · 1 comment

Comments

@ravadisagarrao
Copy link

ravadisagarrao commented Jul 2, 2024

Able to compile code and generate .apk file and Below is the error we are getting during runtime.

07-02 13:57:49.245 19976 20076 E AndroidRuntime: FATAL EXCEPTION: pool-2-thread-5
07-02 13:57:49.245 19976 20076 E AndroidRuntime: Process: com.xyz.xyz.qa, PID: 19976
07-02 13:57:49.245 19976 20076 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlinx/serialization/json/Json;
07-02 13:57:49.245 19976 20076 E AndroidRuntime: at .......
.....
07-02 13:57:49.245 19976 20076 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
07-02 13:57:49.245 19976 20076 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
07-02 13:57:49.245 19976 20076 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012)
07-02 13:57:49.245 19976 20076 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlinx.serialization.json.Json" on path: DexPathList[[zip file "/data/app/~~N6alC4MfPGo0PSOzCyFhTQ==/com.xyz.xyz.qa-kpgx5B81J2Pl9J1wikvpjg==/base.apk"],nativeLibraryDirectories=[/data/app/~~N6alC4MfPGo0PSOzCyFhTQ==/com.xyz.xyz.qa-kpgx5B81J2Pl9J1wikvpjg==/lib/arm64, /data/app/~~N6alC4MfPGo0PSOzCyFhTQ==/com.xyz.xyz.qa-kpgx5B81J2Pl9J1wikvpjg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
07-02 13:57:49.245 19976 20076 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
07-02 13:57:49.245 19976 20076 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
07-02 13:57:49.245 19976 20076 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
07-02 13:57:49.245 19976 20076 E AndroidRuntime: ... 11 more

  1. Tried adding below entries in build.gradle.

**plugins {
id 'org.jetbrains.kotlin.jvm' version '2.0.0'
id 'org.jetbrains.kotlin.plugin.serialization' version '2.0.0'
}
repositories {
mavenCentral()
}

implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1"**

  1. And one more thing what i observed is kotlinx-serialization-json is not getting downloaded to local .gradle folder.

  2. Also, in the generated .apk file I see kotlinx-serialization-json reference but still not able to find during runtime. FYI, please find screen attached.
    image

Environment

  • Kotlin version: [2.0.0]
  • Cordova 6.5.0
  • Gradle version: [6.8.3]
  • CompileSdkVersion=33
  • TargetSdkVersion= 33

Any inputs appreciated.

@sandwwraith
Copy link
Member

I'm not familiar with Cordova, so maybe it requires some additional setup. I can recommend you check if the issue is the same across different variants (debug and release). Maybe your minifying rules are too strict? Also, check in tests: if regular (non-device) tests do not have this problem, this also indicates problem with application packaging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants