All Questions
Tagged with moshi kotlin-coroutines
10 questions
1
vote
2
answers
182
views
Getting Expected BEGIN_OBJECT but was BEGIN_ARRAY error if API returns the empty array Instead of list in kotlin android moshi
Getting error while parsing the API response using Moshi.
Sample Reponses:
Expected API response
{"itemsValues":[{"Id":"567"},{"Id":"678"}]}
If list ...
0
votes
1
answer
236
views
handle kotlin coroutines withContext exceptions inside try-catch not work
I call network operations like this.
viewModelScope.launch {
try {
val data = withContext(dispatcher.io()) { homeRepository.getData() }
} catch (e: Throwable) {
val error = ...
0
votes
1
answer
121
views
Moshi: how to fix "Inappropriate blocking method call" warning in the coroutine?
I use this with DataStore to convert Flow result and it show a warning for the Moshi fromJson method
dataStore.data.map {
val json = it[key]
json?.let { adapter.fromJson(json) } ?: ...
0
votes
2
answers
2k
views
Unable to create converter for kotlinx.coroutines.flow.Flow, No JsonAdapter for kotlinx.coroutines.flow.Flow
In this demo app, I used a retrofit, Moshi, MVVM, dagger hilt, and kotlin coroutine, I got stuck in this exception, I tried to change the structure of suspended fun in PokemonApiService delete it, ...
1
vote
1
answer
2k
views
Retrofit Moshi Unable to create @Body converter for java.util.HashMap
The line EarthlingsApi.retrofitService.register(params)
in my code below
fun clickLogin(){
val params = HashMap<String, String>()
params["email"] = email
params["...
0
votes
1
answer
3k
views
Testing a Retrofit + Moshi ApiService which returns a Deferred Object
I've been trying to build tests for the following API Service, but I can't figure how to build a mock interface for it:
package com.example.themovieapp.network
import com.jakewharton.retrofit2....
2
votes
0
answers
456
views
Using Coroutines along with RxJava and Moshi not working
I am working an Android project that uses RxJava for its network calls and now I'm migrating it to Coroutines. Since the code base is large, I have to use RxJava and Coroutines simultaneously and ...
262
votes
11
answers
105k
views
How to make "inappropriate blocking method call" appropriate?
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 the ...
2
votes
3
answers
3k
views
Unable to successfully send a POST request using Retrofit 2.6.1 - Problems with JSON coverter
I am using the new Retrofit2 with suspending coroutines, and with GET requests everything works fine.
But I now have to implement a POST request, and just can't get it to work
I have a CURL example ...
1
vote
1
answer
78
views
There is a message when retrieving data from the API (data not found), besides showing the data in one place it, it works
There is a message when retrieving data from the API (data not found), besides showing the data in one place it, it works
So the time I run it does not come out anything, and it turns out after I ...