Complete the code to create a Retrofit instance with the base URL.
val retrofit = Retrofit.Builder()
.baseUrl("[1]")
.build()The base URL must end with a slash and include the scheme (https://) for Retrofit to work correctly.
Complete the code to add a JSON converter factory to Retrofit.
val retrofit = Retrofit.Builder()
.baseUrl("https://api.example.com/")
.addConverterFactory([1].create())
.build()GsonConverterFactory is commonly used to convert JSON data to Kotlin objects in Retrofit.
Fix the error in the Retrofit builder code by completing the blank.
val retrofit = Retrofit.Builder()
.baseUrl("https://api.example.com/")
.addConverterFactory(GsonConverterFactory.[1]())
.build()The correct method to get a GsonConverterFactory instance is 'create()'.
Fill both blanks to define a Retrofit service interface with a GET request.
interface ApiService {
@[1]("users")
fun getUsers(): [2]<List<User>>
}The GET annotation defines a GET request, and Call wraps the response type for Retrofit.
Fill all three blanks to build a Retrofit instance with base URL, JSON converter, and create the service.
val retrofit = Retrofit.Builder()
.baseUrl([1])
.addConverterFactory([2].create())
.build()
val service = retrofit.[3](ApiService::class.java)Use the correct base URL string, GsonConverterFactory with create(), and Retrofit's create() method to get the service instance.