moshi Questions

6

I recently upgraded to Android Studio Flamingo and AGP 8.0 My production builds with minfiy and shrinkResources enabled, doesn't allow retrofit to make calls. This is the error thrown. java.lang.Cl...
Hungerford asked 27/4, 2023 at 9:17

3

Solved

I have added both dependencies for Moshi and converter-Moshi but yet MoshiConverterFactory is not accessible and prompting error. Why am I facing this error? I tried to use scalar-converter which w...
Timorous asked 6/6, 2021 at 7:37

2

My goal is to synchronize abitrary rows of data by using the JSON-Format. As I do not know the exact scheme for the rows (it is a general sync method), my datamodel apparently has to rely on "Objec...
Badman asked 23/9, 2016 at 10:6

6

Solved

I am implementing retrofit and moshi to make requests to a server (I am newbie using retrofit). I follow some guides that I found on the internet on how to implement it but when launching the app I...
Suicidal asked 12/1, 2022 at 16:7

2

Solved

I have the following dependencies: moshi-codegen: 1.10.0 kotlin: 1.4.10 Android Gradle Plugin: 4.0.1 R8 is enabled in the build. At runtime, i got the following stacktrace when Moshi tries to parse...
Erda asked 25/9, 2020 at 16:39

3

Solved

The following works: package com.squareup.moshi.problem import com.squareup.moshi.JsonClass import com.squareup.moshi.Moshi @JsonClass(generateAdapter = true) data class Foo( val bar: String? )...
Amarillas asked 12/11, 2019 at 14:19

5

Solved

Error while adding MoshiPack Library in Kotlin latest version 1.3.70 to gradle.build application Moshi pack implementation 'com.daveanthonythomas.moshipack:moshipack:1.0.1' Error Message Dupl...
Overwhelming asked 12/3, 2020 at 21:57

6

Solved

I have developed an Android app, using Moshi as one of its dependencies. Today I want to enable minify for this project. So I set minifyEnabled true in my build.gradle. After that, I found that all...
Chaney asked 15/7, 2019 at 7:20

3

Solved

My Api: @GET("/cinema/notShownMovies") fun getNotShownMovies( @Query("token") token: String ): Response<GetMovieResponse> Exception when trying to call API: java.lang.I...
Audry asked 19/6, 2020 at 6:59

2

Solved

I have an enum class and would like it to fallback to a specific enum value if values don't match any of them. I found a Moshi issue that talks about using EnumJsonAdapter but I don't see any publi...
Circosta asked 9/1, 2019 at 23:24

11

Solved

I am currently trying to leverage kotlin coroutines more. But I face a problem: when using moshi or okhttp inside these coroutines I get a warning: "inappropriate blocking method call" What is th...
Kristikristian asked 3/11, 2019 at 12:11

4

I'm trying to convert a Java object to JSON using the Moshi library for Android. The object contains a property of type ArrayList < float[]> and I'm registering the following adapter to co...
Woolson asked 8/5, 2017 at 16:49

2

I can't seem to figure out this issue... I've tried all sorts of methods to keep required classes and searched for long time to find the solution.... When I apply pro guard, app crashes with this e...
Cymograph asked 27/12, 2021 at 7:8

2

Solved

Problem How to parse either a single Warning object or a list of Warning objects (List<Warning>) from an API using Moshi? The response as a single warning: { "warnings": {...} } T...
Sinecure asked 16/11, 2018 at 19:12

0

I'm trying to use PolymorphicJsonAdapterFactory for JSON which provides different structure depending on type field, like below. { "notifications": [ { "type": "achievem...
Hirsch asked 22/4, 2022 at 9:3

3

I am attempting to add a custom annotation to serialize specific values in my model to null when calling the toJSON method from Moshi. I have something working based on this response but it's falli...
Attenuation asked 26/5, 2021 at 23:19

2

Assuming I need to parse a huge list of Items from a json asset file in Android with the format similar to below: [ { "id": 1, "name: "Tom" // other stuff to describe "Item" } ] For perform...
Mechanics asked 14/2, 2020 at 13:21

4

Solved

The following will produce an IllegalArgumentException because you "Cannot serialize abstract class" sealed class Animal { data class Dog(val isGoodBoy: Boolean) : Animal() data class Cat(val re...
Democratize asked 1/5, 2019 at 9:18

3

Solved

I want to know how to ignore a Kotlin class field when using Moshi. I've found this answer for Java (Moshi ignore field), that indicates to use the keyword transient as follows private transient ...
Hallvard asked 18/11, 2017 at 16:38

3

Solved

I'm running into the following crash and stack trace after upgrading to Moshi 1.9.1 (from 1.8.0): java.lang.IllegalArgumentException: Cannot serialize Kotlin type com.garpr.android.data.models.Ran...
Suprasegmental asked 3/11, 2019 at 4:4

3

Solved

I use Moshi and I need to solve my problem with a buggy backend. Sometimes, when I request a list of objects, some of them don't contain mandatory fields. Of course, I can catch and process JsonDat...
Grief asked 11/1, 2019 at 11:22

1

Solved

I am building an Android app in Kotlin, and I'm using Retrofit for the API calls, and I'm also using Moshi. But when building Moshi it says KotlinJsonAdapteryFactory - unresolved reference, and I c...
Guide asked 19/11, 2021 at 14:23

0

So I usually have this typical error messages when using a new API com.squareup.moshi.JsonDataException: Required value 'X' (JSON name 'x') missing at $ at com.squareup.moshi.internal.Util.missing...
Vaas asked 11/9, 2021 at 11:25

2

Solved

The given assertion will fail due to the error Failed to find the generated JsonAdapter constructor for class GenericType How do I get the proper type from the reified type T for Moshi? The G...
Constructivism asked 21/8, 2019 at 7:39

2

Solved

I'm trying to load an assets Json file into my project with moshi. However, i keep getting the following error: com.squareup.moshi.JsonEncodingException: Use JsonReader.setLenient(true) to accep...
Absorbing asked 25/7, 2019 at 13:8

© 2022 - 2024 — McMap. All rights reserved.