RestAdapter.Builder builder = new RestAdapter.Builder();
builder.setEndpoint(ip地址);//设置远程地址
builder.setConverter(new GsonConverter(GsonUtils.newInstance())); //retrofit中默认用的是Gson来解析JSON数据
builder.setClient(new OkClient(OkHttpUtils.getInstance(context))); //设置网络请求框架
builder.setLogLevel(Config.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE);
builder.setRequestInterceptor(mRequestInterceptor); //设置RequestInterceptor (connection,Content-Type等)
builder..setErrorHandler(mErrorHander); //设置错误回调
具体的API文档地址 :
实例参考文档地址: