Unable to create call adapter for class example.Simple

后端 未结 14 1222
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 23:14

I am using retrofit 2.0.0-beta1 with SimpleXml. I want the retrieve a Simple (XML) resource from a REST service. Marshalling/Unmarshalling the Simple object with SimpleXML w

14条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 23:45

    In case of Kotlin and coroutines this situation happened when I forgot to mark api service function as suspend when I call this function from CoroutineScope(Dispatchers.IO).launch{}:

    Usage:

        val apiService = RetrofitFactory.makeRetrofitService()
    
        CoroutineScope(Dispatchers.IO).launch {
    
            val response = apiService.myGetRequest()
    
            // process response...
    
        }
    

    ApiService.kt

    interface ApiService {
    
           @GET("/my-get-request")
           suspend fun myGetRequest(): Response
    }
    

提交回复
热议问题