Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安卓改型';s@Path don';不行。为什么?_Android_Api_Path_Retrofit - Fatal编程技术网

Android 安卓改型';s@Path don';不行。为什么?

Android 安卓改型';s@Path don';不行。为什么?,android,api,path,retrofit,Android,Api,Path,Retrofit,我有一个应用程序,它从api和显示器获取琐碎问题。当我使用实际链接回答问题时,它会起作用()。然而,当我为类别添加路径时,应用程序不起作用 这是一项工作: @GET("questions?categories=general_knowledge&limit=16") Call<List<Questions>> general(); @GET(“问题?类别=一般知识&限制=16”) 调用general(); 然而,这是行不通的: @GET(&

我有一个应用程序,它从api和显示器获取琐碎问题。当我使用实际链接回答问题时,它会起作用()。然而,当我为类别添加路径时,应用程序不起作用

这是一项工作:

@GET("questions?categories=general_knowledge&limit=16")
Call<List<Questions>> general();
@GET(“问题?类别=一般知识&限制=16”)
调用general();
然而,这是行不通的:

@GET("questions?categories={type}&limit=16")
Call<List<Questions>> getData(@Path("type") String type);
@GET(“问题?类别={type}&limit=16”)
调用getData(@Path(“type”)字符串类型);

另外,当我从emulator中删除应用程序,并使用path include方法再次安装时,它只工作一次。不是第二次。

类别
不是路径参数,而是查询,请改为执行此操作

@GET("questions?limit=16")
Call<List<Questions>> getData(@Query("categories") String categories);
@GET(“问题?限制=16”)
调用getData(@Query(“categories”)字符串categories);

关于你提到的第二个问题,在提供的代码中没有任何内容可以从

中找到,不客气,伙计。路径参数就是这些参数。在路径中(它们总是出现在
之前)和查询参数位于
之后,由
分隔