question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

kotlinxDeserializerOf in fuel-kotlinx-serialization crashes with kotlin 1.3.70 and kotlinx.serialization 0.20.0

See original GitHub issue

Bug Report

Description

When using kotlin 1.3.70 and kotlinx.serialization 0.20.0, kotlinxDeserializerOf crashes on use. Kotlin 1.3.70 requires kotlinx.serialization 0.20.0.

To Reproduce

Steps to reproduce the behavior:

  1. Use kotlinxDeserializerOf
val deserializer = kotlinxDeserializerOf(JsonObject.serializer())

Expected behavior

Do not crash. Here is the stacktrace:

2020-03-09 11:51:43.626 15027-15027/com.example.test E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.test, PID: 15027
    java.lang.NoSuchFieldError: No field Companion of type Lkotlinx/serialization/json/Json$Companion; in class Lkotlinx/serialization/json/Json; or its superclasses (declaration of 'kotlinx.serialization.json.Json' appears in /data/app/com.example.test-Q10Jp2kFGAok9G4WvSYvAw==/base.apk)
        at com.example.test.app.RestClient.login(RestClient.kt:92)
        at com.example.test.LoginEmailFragment$ViewModel$login$1.invokeSuspend(LoginEmailFragment.kt:51)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedKt.resumeCancellable(Dispatched.kt:457)
        at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:26)
        at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109)
        at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:154)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
        at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
        at com.example.test.LoginEmailFragment$ViewModel.login(LoginEmailFragment.kt:50)
        at com.example.test.databinding.ContainerLoginEmailBindingImpl._internalCallbackOnClick(ContainerLoginEmailBindingImpl.java:390)
        at com.example.test.generated.callback.OnClickListener.onClick(OnClickListener.java:11)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.onKeyUp(View.java:13216)
        at android.widget.TextView.onKeyUp(TextView.java:7782)
        at android.view.KeyEvent.dispatch(KeyEvent.java:2798)
        at android.view.View.dispatchKeyEvent(View.java:12450)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1896)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1896)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1896)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1896)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1896)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1896)
        at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:438)
        at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1821)
        at android.app.Activity.dispatchKeyEvent(Activity.java:3373)
        at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:122)
        at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:84)
        at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:140)
        at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:352)
        at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5056)
        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4922)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4443)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4496)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4462)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4602)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4470)
        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4659)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4443)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4496)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4462)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4470)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4443)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4496)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4462)

Environment

Development Machine

Complete the following information if applicable

  • OS: Mac OSX Mojave 10.14.6 (18G3020)
  • IDE: Android Studio 3.6.1
  • Fuel version: 2.2.1
  • Kotlin version: 1.3.70
  • Kotlinx.serialization version: 0.20.0

Smartphone or Emulator

Complete the following information if applicable

  • Device: Pixel 3XL
  • OS: Android 10.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kittinunfcommented, Mar 15, 2020

https://github.com/kittinunf/fuel/pull/722 I tried to update core version in this PR. I will try to bump to 1.3.70 and 0.20.0 🙇

0reactions
Chubaccacommented, Apr 5, 2020

Looks good. Maybe you could make a shared Json(JsonConfiguration.Stable) object so you’re not creating a new object every time?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding a dependency on kotlinx-serialization-core:1.3.0 and ...
Adding a dependency on kotlinx-serialization-core:1.3.0 and up crashes kmm library builds when using kotlin 1.6.10 ; Type, Bug B ; Subsystem, No Subsystem....
Read more >
android kotlin multiplatform kotlinx.serialization works on ...
If deserialization still fails, please provide an example of how you are deserializing network response(s) into data classes. Share.
Read more >
kotlinx-serialization-runtime - Maven Repository
Version Vulnerabilities Repository Usages Date 0.20.x 0.20.0‑1.4.0‑rc‑95 KotlinX 3 Jul 06, 2020 0.20.0‑1.4.0‑rc‑81 0.20.x KotlinX 3 Jul 06, 2020 0.20.0‑1.4‑M3 0.20.x KotlinX 5 Jul 03, 2020...
Read more >
kotlinx-serialization-runtime-common : 0.20.0 - Maven Central
kotlinx -serialization-runtime - Kotlin multiplatform serialization runtime library.
Read more >
Kotlin JSON serialization crash course - Rock and Null
Kotlin provides a built-in way for serializing to and from JSON. ... "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0" [...] }
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found