retrofit是 一个 网络框架,底层使用 okhttp
配置如下
/*retrofit*/
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0' //支持string converter
compile 'com.squareup.retrofit2:converter-gson:2.1.0' //支持 goson converter
compile 'com.google.code.gson:gson:2.6.1'
Retrofit retrofit = new Retrofit.Builder().
baseUrl("http://xxxxxxxx").
//支持 String返回值
addConverterFactory(ScalarsConverterFactory.create()).
//支持gson 返回值
addConverterFactory(GsonConverterFactory.create()).
build();
requestInter = retrofit.create(RequestInter.class);