I am trying to get the question name and the number of its ratings by API . The application does not start with this code. Help to understand please.
package com.example.test import android.support.v7.app.AppCompatActivity import android.os.Bundle import android.widget.ListView import retrofit2.Retrofit import retrofit2.http.GET import retrofit2.http.Query import android.widget.ArrayAdapter import com.google.gson.annotations.SerializedName class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val listview = findViewById<ListView>(R.id.listView) var retrofit = Retrofit.Builder().baseUrl("https://api.stackexchange.com/").build() val service = retrofit.create(StackExchangeService::class.java) val repos = service.GetQuestions("stackoverflow") val Final = arrayOf( repos ) val adapter = ArrayAdapter( this, android.R.layout.simple_list_item_1, Final) listview.adapter = adapter } } interface StackExchangeService { @GET("2.2/questions?page=1&pagesize=20&order=desc&sort=votes&site=stackoverflow") fun GetQuestions(@Query("stackoverflow") stackoverflow: String) : retrofit2.Call<Question> } data class Question ( @SerializedName("title") val Title: String, @SerializedName("score") val Score: Int )
Error text:
Caused by: java.lang.IllegalArgumentException: Could not locate ResponseBody converter for class com.example.test.Question. Tried: * retrofit2.BuiltInConverters * retrofit2.OptionalConverterFactory at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:349) at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:311) at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:68) ... 22 more