When I use the static Retrofit object the application crashing with the below log I cannot use the retrofit object without static because i am using it too often. Please let me know the workaround for the same
W/WindowAnimator: Failed to dispatch window animation state change.
        android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:513)
at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:548)
at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:302)
at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:694)
at com.android.server.wm.WindowAnimator.access$000(WindowAnimator.java:56)
at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:128)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:894)
at android.view.Choreographer.doCallbacks(Choreographer.java:698)
at android.view.Choreographer.doFrame(Choreographer.java:630)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:882)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Some Time i get this error too
Fail to sendHttpRequest
                                              java.lang.IllegalArgumentException: HTTP entity may not be null
                                                  at org.apache.http.util.EntityUtils.toString(EntityUtils.java:115)
                                                  at org.apache.http.util.EntityUtils.toString(EntityUtils.java:151)
                                                  at miui.util.ErrorReport.c(SourceFile:396)
                                                  at miui.util.ErrorReport.sendReportRequest(SourceFile:353)
                                                  at miui.util.ErrorReport$1.a(SourceFile:369)
                                                  at miui.util.ErrorReport$1.doInBackground(SourceFile:366)
                                                  at android.os.AsyncTask$2.call(AsyncTask.java:295)
                                                  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
                                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                  at java.lang.Thread.run(Thread.java:818)
Here is the retrofit object which is working fine
public static Retrofit getAPIClient(Context context) {
        return new Retrofit.Builder()
                .baseUrl(context.getString(R.string.base_url))
                .client(getOkHttpClient(context))
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create(getGson()))
                .build();
    }
But when I converted this to static it is crashing
     if ( appApiClient == null ) {
                appApiClient = new Retrofit.Builder()
                        .baseUrl( context.getString( R.string.base_url ) )
                        .client( getOkHttpClient( context)
                        .addCallAdapterFactory( RxJavaCallAdapterFactory.create() )
                        .addConverterFactory( GsonConverterFactory.create( getGson() ) )
                        .build();
       }
      return appApiClient ;