2017-02-15 137 views
0

此例外只出現在一部手機中,而其他手機正常。我應該如何解決這個問題?這個異常與proguard有關嗎?Retrofit @ java.lang.IllegalArgumentException:@FieldMap鍵必須是字符串類型:K(參數#2)

詳細例外:

java.lang.IllegalArgumentException: @FieldMap keys must be of type String: K (parameter #2) 
for method g.d 
at retrofit2.ServiceMethod$Builder.methodError(Unknown Source) 
at retrofit2.ServiceMethod$Builder.methodError(Unknown Source) 
at retrofit2.ServiceMethod$Builder.parameterError(Unknown Source) 
at retrofit2.ServiceMethod$Builder.parseParameterAnnotation(Unknown Source) 
at retrofit2.ServiceMethod$Builder.parseParameter(Unknown Source) 
at retrofit2.ServiceMethod$Builder.build(Unknown Source) 
at retrofit2.Retrofit.loadServiceMethod(Unknown Source) 
at retrofit2.Retrofit$1.invoke(Unknown Source) 
at $Proxy0.d(Native Method) 

回答

0

由於沒有代碼片段,我建議你向你的服務方法的簽名更改從@FieldMap HashMap/Map params@FieldMap HashMap<String, String> params。並稱它是這樣的

HashMap<String, String> params = ServiceUtil.getInstance().getDefaultParams(); 
           maisService.fetchAjudaCategorias(params) 

這應該很好。

相關問題