Java 为什么在改装后操作中获取属性值必须为常量错误?
我正试图将标记添加到HTTP@POST中的url字符串中,但我得到了 属性值必须为常量错误 。我不明白为什么?我正在使用改装2 **Java 为什么在改装后操作中获取属性值必须为常量错误?,java,android,retrofit,Java,Android,Retrofit,我正试图将标记添加到HTTP@POST中的url字符串中,但我得到了 属性值必须为常量错误 。我不明白为什么?我正在使用改装2 ** 公共接口API{ 静态最终字符串url=(“/secure/frrest/oauth2/token/”+Prefs.getSmartPassAccessToken(App.getContext())+“?\u action=revokeTokes”); @FormUrlEncoded @帖子(url) void smartpassnonpersistentlogo
公共接口API{
静态最终字符串url=(“/secure/frrest/oauth2/token/”+Prefs.getSmartPassAccessToken(App.getContext())+“?\u action=revokeTokes”);
@FormUrlEncoded
@帖子(url)
void smartpassnonpersistentlogout(@Header(“内容类型”)字符串内容类型,
@字段(“客户端id”)字符串客户端id,
回调(回调);
**您可以改用这个
public interface API {
@FormUrlEncoded
@POST("/secure/frrest/oauth2/token/{token}")
void smartpassnonpersistentlogout(@Path("token") String token,@Query("_action")String _action,@Header("Content-Type") String content_type,
@Field("client_id") String client_id,
Callback<SmartPassResponse> callback);
在提问之前,请进行一些搜索。此问题已得到回答,例如此处:或此处:
public interface API {
@FormUrlEncoded
@POST("/secure/frrest/oauth2/token/{token}")
void smartpassnonpersistentlogout(@Path("token") String token,@Query("_action")String _action,@Header("Content-Type") String content_type,
@Field("client_id") String client_id,
Callback<SmartPassResponse> callback);
String token=Prefs.getSmartPassAccessToken(pass_context);
yourinterface.smartpassnonpersistentlogout(token,"revokeTokens",...add remaining params);