Reputation: 740
I tried to use Retrofit with invoke() method but an error occurred
suspend {
Retrofit.Builder()
.baseUrl("https://api.openweathermap.org/data/2.5/")
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(WeatherApi::class.java)
.getPost("-33.8523341", "151.2106085", "***********API**********")
}.invoke()
getPost() Method
@GET("onecall?units=metric")
fun getPost(
@Query("lat") lat: String,
@Query("lon") lon: String,
@Query("APPID") app_id: String
): WeatherData
Error
java.lang.IllegalArgumentException: Unable to create call adapter for
class com.example.weatherapp.data.responses.WeatherData
for method WeatherApi.getPost
Upvotes: 0
Views: 1128
Reputation: 740
@GET("onecall?units=metric")
suspend fun getPost( //use suspend
@Query("lat") lat: String,
@Query("lon") lon: String,
@Query("APPID") app_id: String
): WeatherData
Upvotes: 3