在使用Retrofit來作為網(wǎng)絡(luò)請求庫之后岂贩,筆者查閱了網(wǎng)上的有關(guān)教程,無外乎都是請求json數(shù)據(jù)个扰,使用addConverterFactory(GsonConverterFactory.create())來作為轉(zhuǎn)化器瓷炮,如果業(yè)務(wù)需求是請求 字符串,而不是json數(shù)據(jù)格式呢递宅,繼續(xù)使用這個轉(zhuǎn)換器就會產(chǎn)生錯誤娘香。
官方文檔查閱:http://square.github.io/retrofit/
Paste_Image.png
String類型:
compile 'com.squareup.retrofit2:converter-scalars:2.0.0'