android定义改造接口时如何解决'@GET' not applicable to field Error
How to solve '@GET' not applicable to field Error while defining retrofit interface in android
我正在尝试通过改造提取 json 数据,但是在使用 @GET 方法时,弹出此错误“'@GET' not applicable to field
”。解决方法是什么?
我的界面
import com.google.gson.JsonElement;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Url;
public interface IHealthAPI {
//https://data.ibb.gov.tr/dataset/istanbul-saglik-kurum-ve-kuruluslari-verisi/resource/6800ea2d-371b-4b90-9cf1-994a467145fd/view/e7f57e67-3f8f-4c82-987b-fef5d0c9099a
//https://data.ibb.gov.tr/dataset/bd3b9489-c7d5-4ff3-897c-8667f57c70bb/resource/6800ea2d-371b-4b90-9cf1-994a467145fd/download/salk-kurum-ve-kurulularna-ait-bilgiler.json
@GET("/istanbul-saglik-kurum-ve-kuruluslari-verisi/resource/6800ea2d-371b-4b90-9cf1-994a467145fd/view/e7f57e67-3f8f-4c82-987b-fef5d0c9099a") //underlined in red and @GET' not applicable to field error occuring
Call<List<ModelRetrofit>> getHealthInfos;
}
您的函数定义缺少括号
改变
Call<List<ModelRetrofit>> getHealthInfos;
至
Call<List<ModelRetrofit>> getHealthInfos();
我正在尝试通过改造提取 json 数据,但是在使用 @GET 方法时,弹出此错误“'@GET' not applicable to field
”。解决方法是什么?
我的界面
import com.google.gson.JsonElement;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Url;
public interface IHealthAPI {
//https://data.ibb.gov.tr/dataset/istanbul-saglik-kurum-ve-kuruluslari-verisi/resource/6800ea2d-371b-4b90-9cf1-994a467145fd/view/e7f57e67-3f8f-4c82-987b-fef5d0c9099a
//https://data.ibb.gov.tr/dataset/bd3b9489-c7d5-4ff3-897c-8667f57c70bb/resource/6800ea2d-371b-4b90-9cf1-994a467145fd/download/salk-kurum-ve-kurulularna-ait-bilgiler.json
@GET("/istanbul-saglik-kurum-ve-kuruluslari-verisi/resource/6800ea2d-371b-4b90-9cf1-994a467145fd/view/e7f57e67-3f8f-4c82-987b-fef5d0c9099a") //underlined in red and @GET' not applicable to field error occuring
Call<List<ModelRetrofit>> getHealthInfos;
}
您的函数定义缺少括号
改变
Call<List<ModelRetrofit>> getHealthInfos;
至
Call<List<ModelRetrofit>> getHealthInfos();