Issue
I'm having an issue.I have project and then i copy paste into an other new project and i'm facing this error
No type arguments expected for class Call
In the first project i didn't have any problem... Here is my interface class which i have the error
interface ApiInterface {
@GET("data/2.5/weather?q=Prague")
fun getWeatherData(@Query("units") units: String,
@Query("appid") appId: String)
:Call<WeatherData> //here is the error
}
and here is my WeatherData class
data class WeatherData(
@SerializedName("coord") val coord: Coord,
@SerializedName("weather") val weather: List<Weather>,
@SerializedName("base") val base: String,
@SerializedName("main") val main: TemperatureData,
@SerializedName("visibility") val visibility: Int,
@SerializedName("wind") val wind: Wind,
@SerializedName("clouds") val clouds: Clouds,
@SerializedName("dt") val dt: Int,
@SerializedName("sys") val sys: Sys,
@SerializedName("id") val id: Int,
@SerializedName("name") val name: String,
@SerializedName("cod") val cod: Int
)
data class Sys(
@SerializedName("type") val type: Int,
@SerializedName("id") val id: Int,
@SerializedName("message") val message: Double,
@SerializedName("country") val country: String,
@SerializedName("sunrise") val sunrise: Int,
@SerializedName("sunset") val sunset: Int
)
data class Coord(
@SerializedName("lon") val lon: Double,
@SerializedName("lat") val lat: Double
)
data class TemperatureData(
@SerializedName("temp") val temp: Double,
@SerializedName("pressure") val pressure: Int,
@SerializedName("humidity") val humidity: Int,
@SerializedName("temp_min") val tempMin: Double,
@SerializedName("temp_max") val tempMax: Double
)
data class Weather(
@SerializedName("id") val id: Int,
@SerializedName("main") val main: String,
@SerializedName("description") val description: String,
@SerializedName("icon") val icon: String
)
data class Clouds(
@SerializedName("all") val all: Int
)
data class Wind(
@SerializedName("speed") val speed: Double,
@SerializedName("deg") val deg: Int
Solution
Just verify that you've imported the correct package from Retrofit
.
The correct one is
retrofit2.Call
not to be confused with, for example
android.telecom.Call
Answered By - Ollaw
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.