I am working on an Android App with Retrofit2 and OkHttp and it´s the first time that I use both frameworks. The Retrofit Request fails with the error message " java.lang.NullPointerException: client == null" in Line 138 of my Android Service class: static Retrofit retrofit = new Retrofit.Builder().baseUrl(PalletteApi.BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .client(okHttp) .build(); the okHttp Instance that ..
Category : retrofit2
It is the first time I work with api, and I have had difficulty converting them to objects in kotlin, I am using retrofit and moshi. I have made a first practice a format of the api I would say as basic as possible: { "estudiantes": [ { "cedula": "6-666-6666", "nombre": "Nombre1", "edad": 22 }, ..
I’m using Google Codelab to learn HTTP request using Retrofit/Moshi in kotlin . https://codelabs.developers.google.com/codelabs/kotlin-android-training-internet-data/#4 Right now, I’m trying to access a nested JSON object of Google Books API but im not able to parse it. { "kind": "books#volumes", "items": [ { "id": "t4rgAAACAZAJ", "volumeInfo": { "title": "Harry Review", "authors": [ "International ISBN Agency" ], "imageLinks": ..
I’m trying to develop a app with based_token auth using laravel/sanctum and kotlin, i’m a beginner. I already implemented sanctum and tested in postman and work perfectly, but when i’m going to use android emulator from android studio retrofit calls return always 401. for connect device(android emulator) and postman to laravel i used php artisan ..
I am developing an Android application in which I would like to call an API using Retrofit. The requires authorization token in the header and I added the same as well. Below are the code snippets RetrofitClient.kt object RetrofitClient { var apiInterface: APIInterface? = null val okHttpClient = OkHttpClient.Builder() .connectTimeout(300, TimeUnit.SECONDS) .writeTimeout(300, TimeUnit.SECONDS) .readTimeout(180, TimeUnit.SECONDS) ..
YoutubeData.java package bsi.ekosantoso.movieapi; public class YoutubeData { private int id; private String key; private String name; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getName() { return name; } ..
How do I parse a JSON response through an AES256 String? Now off the back of this I want to be able to register users through my app/api. For a prerequisite I need to pass the following response to the API for it to work correctly: {"uid":"[email protected]","pwd":"Test","data": (aes 256 ctf encrypted string)} As it stands ..
I’m trying to build a login/registration system using retrofit2 in android studio and I cannot figure out for the life of me what I am doing wrong I’ve tried multiple test API’s and they return the correct response. To give you a breakdown My API Needs three things for login (That’s the following): {"uid": "username", ..
I am developing currency app but when I am trying to implement network call in mainactivity.kt it is giving an error I did not understand where exactly I am making an error below my MainActivity.kt where I have implemented retrofit network call class MainActivity : AppCompatActivity() { private var listUsers: MutableList<Quotes> = mutableListOf<Quotes>() private var ..
I have read quite a few resources and tutorials so far, and I still haven’t found the solution I need. The problem is that my application using Retrofit 2 does not send requests to my own server. Empirically, it was revealed that requests are not sent only to addresses using http. Requests were sent to ..
Recent Comments