package com.gh.gamecenter; import android.app.Application; import com.facebook.stetho.Stetho; import com.facebook.stetho.okhttp3.StethoInterceptor; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; /** * @author CsHeng * @Date 03/09/2017 * @Time 4:34 PM */ public class Injection { public static boolean appInit(Application application) { // init stetho Stetho.initializeWithDefaults(application); // 监控Bundle大小,预防溢出(需要调试的时候再开启吧!) // TooLargeTool.startLogging(application); return true; } public static OkHttpClient.Builder provideRetrofitBuilder() { OkHttpClient.Builder builder = new OkHttpClient.Builder(); HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); builder.addNetworkInterceptor(interceptor); builder.addNetworkInterceptor(new StethoInterceptor()); return builder; } }