Context.getApplicationContext()' on a null object when using OkHttp cache

applicationContext.cacheDir must call after onCreate() in Application class.

In your code myHttpClient() is calling before onCreate() so applicationContext is null.

To solve this problem you can create retrofit in Application onCreate()