Questions tagged [retrofit]

Retrofit is a type-safe REST client for Android and Java by Square, Inc.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

How to execute Kotlin Coroutine API services parallelly?

I'm implementing a Login system in android Kotlin, Coroutine, Room and Retrofit using MVVM. Once the user is pressed Login Button, it executes fetchInitialApicalls() is executed. fun ...
Vijan Kaush's user avatar
0 votes
0 answers
38 views

Can't connect to API with phone using Android Studio [closed]

When I try to call any API endpoint (with a real phone) to get data from my local database using retrofit, I get an error: Failed to connect to /10.24.26.180:5294 If I try it on emulator in Android ...
Tin's user avatar
  • 11
0 votes
0 answers
19 views

API Requests Failing for Some Users Despite Stable Internet Connection

I have deployed a native Android app built in Kotlin and Retrofit to the Play Store, currently used by over 200k users. While the majority of users are experiencing no issues and the app works fine, I'...
kotlin_noob's user avatar
0 votes
1 answer
57 views

Search functionality with retrofit and mvvm android

I have an android application which I use MVVM and Retrofit in. and I want to apply search in this application I have an api for search and api return result correctly via post man but when I try to ...
Mohamed Hossam's user avatar
0 votes
0 answers
41 views

Why my MoshiConverterFactory is slower then GsonConverterFactory?

when I post an api, it took too many time to response Here is my retrofit builder: fun provideRetrofit(baseUrl: String): Retrofit = Retrofit.Builder() .client(provideOkhttpClient()) ....
aile's user avatar
  • 1
0 votes
0 answers
35 views

Error Found: Java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $

I keep on getting the error from my Android App: Java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $ I was just trying to test a post method from my ...
ecmcieabril's user avatar
2 votes
1 answer
53 views

How to convert ResponseBody to JSONObject in Retrofit Android

I am calling API using Retrofit in Android. and get response from POST method in form of ResponseBody. As,my API call is as follow- @POST("api/auth/store-login") fun postLoginDetail(@Body ...
Poojan's user avatar
  • 33
1 vote
0 answers
32 views

How to download a file using file name

I have a list of records which I am getting from the API call, on the each item of that list I have a file name with other data. That file name is something like f354jklja.png or kioad87943kjkjd.pdf. ...
Sumita's user avatar
  • 11
0 votes
0 answers
23 views

Retrofit. Wait for firebase token before making real network call?

I have recently built a proxy in my google cloud that authenticates a user. In my app, I get a firebase token that I get at start up. The firebase token is returned in a callback. How can I make sure ...
Oscar Berggren's user avatar
0 votes
0 answers
18 views

Moshi and Retrofit: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path

I'm using Moshi with Retrofit and trying to query some game data. When I do this I get an error stating the following: com.squareup.moshi.JsonDataException: Expected BEGIN_ARRAY but was BEGIN_OBJECT ...
Daniel's user avatar
  • 55
1 vote
1 answer
63 views

Flutter Retrofit issue with two different json response in one API

I have been using Retrofit for API calling. In one of the API sending two different response and trying to get them in Map<String, dynamic> But in generated file it is showing error. When i ...
Farhana Naaz Ansari's user avatar
1 vote
0 answers
23 views

Batch Processing in Android using Retrofit

I am trying to achieve batch processing in android in java using retrofit. I have a batch payload with me, when i use it in postman it gives me a response of 201 with the correct body, but when i try ...
Mohnish Kamble's user avatar
0 votes
0 answers
18 views

Postman post request returns 200 but retrofit returns 500

When i make a post request from postman to sent the fcm device token to nodejs server everything works as expected. When itry to make the same call from android device i get the error: retrofit2....
mikelantzelo's user avatar
0 votes
0 answers
25 views

android retrofit encode "/" will be "\/"

This is raw data "imageUrl": "https://xxxx.com/xxxx/imgame27035.png" this is retrofit encode data "ImageUrl": "https:\/\/xxxx.com\/xxxx\/imgame27035.png" It ...
GHH's user avatar
  • 1,797
0 votes
0 answers
24 views

Dio HTTP 5.0.4 compatibility issue: "Response<dynamic>" not assignable to "Response<Map<String, dynamic>>"

I'm facing a compatibility issue after upgrading Dio to version 5.3.3 and Dio HTTP to version 5.0.4 in my Flutter project. The specific error message is: Code: The argument type 'Response<Map<...
Sheroz shahid's user avatar
-1 votes
0 answers
22 views

Creating refresh token mechanism when token is expired using interceptor and authenticator

I want to create a refresh token mechanism in my retrofit request so if the token is expired i can refresh it and call by the same request i am using hilt dependency injection and retrofit client when ...
Nadeem's user avatar
  • 81
0 votes
0 answers
10 views

How to print an API doc for kotlin data classes with @SerializedName annotation

I'm trying to create a document with a list of kotlin data classes that contain @SerializedName("propertyName") fields. Ideally it would be some retrofit plugin that will output endpoints ...
David Aleksanyan's user avatar
1 vote
1 answer
69 views

Connect Kotlin Retrofit with Nodejs Server

I’m trying to connect my Koltin project to the Nodejs backend server using Retrofit but I get a white blank screen whenever I run the mobile app here is my Adapter code import android.view....
Joksova's user avatar
  • 71
0 votes
0 answers
49 views

Retrofit response is null but okHttp Interceptor logger has data

I have a POST request to get data based on a SessionKey that's generated. If the SessionKey is valid, then there is a response of some Customer data. The issue I'm facing is that my Retrofit instance ...
Dean Ball's user avatar
0 votes
0 answers
19 views

Cannot show name or null from api when after login using getParcelableExtra

I want to display the name, what happens is that the name cannot be displayed or null. Here I use getParcelableExtra, I think my code still has errors, but I don't understand where the error is. this ...
falah's user avatar
  • 1
0 votes
1 answer
70 views

Should I separate repositories to deal with database, and api calls, or should I just make one?

I'd like to make an app which using: MVVM Retrofit Junit4 / mockito / espresso ROOM database HILT Multiple fragments Afaik, I need separate ViewModel for each fragment, is that correct? But what ...
asdwq's user avatar
  • 25
0 votes
1 answer
20 views

Sending enum via PUT method, Retrofit | Error 400

I want to send enum class to API via Retrofit. For parsing I'm using Gson. Enum class that I'm sending: enum class TaskState { NOT_ASSIGNED, IN_PROGRESS, CLOSED, DELETED } My Retrofit method: @PUT(&...
amtrax's user avatar
  • 618
0 votes
0 answers
49 views

Ktor on App Engine with Java 17 runtime unable to read request headers

I just migrated from Java 8 runtime to Java 17 on my Ktor project that runs on Google App Engine Standard environment. The project compiles and is being deployed without issues, the request response ...
Anudeep Ananth's user avatar
0 votes
0 answers
17 views

Adding GSONConvertorFactory to retrofit2 while calling an API

I have many API's which I am calling from my application. On response I have default GsonConvertorFactory which converts the JSON response to the corresponding Java objects with exact number and name ...
shubham's user avatar
  • 47
0 votes
0 answers
32 views

Custom Adapter to filter objects based on a parameter from an JSON response in Retrofit using Moshi

I am getting an API response as below. The data field is an array of Design objects. I want to filter the contents based on type field into different lists. { "code": 200, "data&...
Pawan Harariya's user avatar
0 votes
0 answers
22 views

Trust anchor for certification path not found. Android Compose Kotlin

network-security-config file : <network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="false">localhost</...
SasidharanIOS's user avatar
0 votes
3 answers
51 views

how to parse Json data with custom deserialization

I'm sending API Call and getting response like that { "12312412312124123124": { "id": "12312412312124123124", "content": [ { "id": 41419969} ] }, &...
Daviti Gogochishvili's user avatar
-1 votes
2 answers
103 views

Unable to parse Json data in Android Kotlin MVVM architecture

I am creating an application in which I am calling rest api and storing all the data in SQLite Room Database and then I am retrieving that data from Room Database and display in RecycleView below is ...
Moin Khan's user avatar
  • 672
1 vote
0 answers
52 views

body parameters not being sent with retrofit POST request

I am trying to send one object to api (using Retrofit) with POST request from my android app but the parameters are not being sent. The retrofit interface function is as follows: @POST(URLs.REGISTER) ...
user1Tech's user avatar
0 votes
0 answers
45k views

" '_Service.xxxx' isn't a valid override of 'Service.xxxx' " when generating retrofit code - Dart

I'm trying to use Retrofit and its generator to create an API Client service for my Flutter application. But after I run the command dart run build_runner build and the new file is generated, it has ...
WhatIf's user avatar
  • 1
1 vote
1 answer
51 views

Empty data is coming from retrofit

I'm writing an application for currencies. Empty data is received (Json is normal). I tried to debug it, but I didn’t understand where and what the error was. I would be grateful if you can help me ...
Vlad Tkachev's user avatar
0 votes
0 answers
52 views

How to create a data class for RestCountries json response. Android Retrofit

First of all I'm building a small android app, basically when i click on the europe button for example, it will fetch data from https://restcountries.com/v3.1/region/europe. the problem is when i ...
Giga Shubitidze's user avatar
0 votes
1 answer
25 views

How to POST JSONObject to raw JSON in the body of a Retrofit request

I have a JSONObject and i need to pass this JSONObject to server .Using POST method. @POST("Sync_Status") @Headers("Content-Type: application/json; charset=utf-8") Call<...
Angel's user avatar
  • 1
0 votes
1 answer
136 views

Send Image to server, Multipart.Part, Jetpack compose, retrofit

I want send profile image to server i use retrofit with jetpack compose, but i get this error: 400 Required Part [image] not specified can u help me? My composable val photoPicker = ...
Alexey's user avatar
  • 17
0 votes
0 answers
72 views

How can I convert an API response to objects of any type in Kotlin using Retrofit?

I'm working on an application with about 100 different tables in the room database. This application must periodically search the server for possible changes in any of those 100 tables from a given ...
A. Cedano's user avatar
  • 593
0 votes
1 answer
31 views

ERROR = Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

I have API: import com.poklad.androidtestprojectny.data.remote.model.ResponseCategory import com.poklad.androidtestprojectny.utils.ApiConstants import retrofit2.http.GET import retrofit2.http.Query ...
Max's user avatar
  • 1
1 vote
0 answers
101 views

Status code 200 but still data not loading in server end

In my Android app, for update profile page I am using API, and when I call the API the response is showing success and I check the status code 200 but the data is not loaded in database, using Postman ...
Mamta's user avatar
  • 49
3 votes
3 answers
76 views

How to Parse a Retrofit JSON Response with Dynamic Keys and Variable Object Names in Android?

I have used retrofit as calling API in android, And I am getting response like this. { "data": { "garden": { "id": "31", "name": &...
Urvish Stack's user avatar
1 vote
1 answer
232 views

How to prevent parallel refresh token requests while using Retrofit/OkHttp's Authenticator?

I just stumbled upon an issue where I started sending too parallel refresh token requests to the backend server I built, which caused concurrency issues where there is a race condition in which all ...
BP9381's user avatar
  • 79
0 votes
1 answer
41 views

Unable to return Array list added into retrofit enqueue method [duplicate]

I try to add arrays into a an array inside retrofit enqueue method. but it doesn't return array. i have codes like below. i don't know what mistake i made. private fun getAllAudio():ArrayList<Music&...
coppersmith's user avatar
0 votes
0 answers
34 views

Do I have to use nullable properties in app, even if I need whole data?

I have an app, which using retrofit, and room. As far as I know (but still learning) it is nice practice, to keep things nullable, so it'll be easier to test later on. Now, I have a question: Do I ...
katowicenocom's user avatar
0 votes
0 answers
43 views

File upload failing to the server by Retrofit

i'm trying to upload a file into server by retrofit. in postman i got api response successfully. but when i call the api in my project then the api call is failing. retrofit method: @Multipart @POST(&...
Asikur Rahman's user avatar
0 votes
0 answers
28 views

Authorization Bearer token HEADER is not been added to ApiClient in Retrofit

I was developing an app where I need to pass a sessionToken recover on a register screen to the rest of app call's. The register call goes fine and bring me the token correctly, but when I try to add ...
Manuel Lucas's user avatar
0 votes
1 answer
74 views

Android Retrofit + XML response gives this error : java.lang.RuntimeException: org.simpleframework.xml.core.PersistenceException

I do have an API which returns the following XML response (check the screenshot) I am using Retrofit with XML, check my dependencies: implementation 'com.squareup.retrofit2:retrofit:2.9.0' //retrofit ...
Kishan Solanki's user avatar
0 votes
1 answer
62 views

What are the disadvantage of declaring all request parameter of an endpoint?

Since Kotlin enables us to define default values for a method's parameters and lets us optionally pass parameters by their name, I prefer to define all the endpoint request parameters when declaring ...
Mohammad Reza Khahani's user avatar
0 votes
2 answers
182 views

In Android, Room and Retrofit doesn't support KMP, what should I use instead? [closed]

I have an Android project that I would like to make a KMP project so I can run it on iOS as well, I'm using Room and Retrofit libraries but seems like they don't support KMP because they generate Java ...
josef atef's user avatar
0 votes
1 answer
49 views

NoSuchMethodError: Class 'String' has no instance method 'toJson'

I get NoSuchMethodError: Class 'String' has no instance method 'toJson'. error after I've changed some API requests. I've already tried to rebuild .g files multiple times. Example of service: @GET(&...
Nikita Shadkov's user avatar
0 votes
1 answer
82 views

How is Retrofit 2 processing the functions annotations from the API service interface passed to retrofit.create()?

I'm new to programming in Java and try to understand how annotations works in big libraries. Can someone show me code snippet in which retrofit is actually processing the functions annotations from ...
1Sayd's user avatar
  • 3
0 votes
1 answer
22 views

Kotlin - Can not send query data to service correctly

I am trying build an app using Coin Gecko API. I am using specific service called /api/v3/coins/{id}. For example, the id of the BTC coin is "bitcoin". So the request should be something ...
hgokumus35's user avatar
0 votes
0 answers
82 views

Kotlin + Compose for desktop: different use/import of libraries between executed code and compiled .msi code

In my project I'm using these library imports: implementation("com.squareup.retrofit2:retrofit:2.9.0") implementation("com.squareup.retrofit2:converter-moshi:2.9.0") implementation(...
Adamo Branz's user avatar

1
2 3 4 5
172