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
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
Give a look to import section and check whether retrofit2.Call library is imported or not ,sometimes it gets touched with okhttp3.call but you have to use the retrofit one.so make sure the library is imported to the interface/class.
If you import
both Retrofit
and Okhttp
, make sure the Call class you use is the one from Retrofit:
import retrofit2.Call
not:
import okhttp3.Call
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With