I'm having a problem understanding why my code fai...
# android
c
I'm having a problem understanding why my code fails and passes based on some simple change. In my RetrofitAdapter class, if I have this property like this
Copy code
private val httpLogging = HttpLoggingInterceptor().apply {
    level = HttpLoggingInterceptor.Level.BODY
  }
It crashes my app with error
java.lang.IllegalArgumentException: interceptor == null
, but if I change it to
Copy code
private val httpLogging 
      get() = HttpLoggingInterceptor().apply { 
        level = HttpLoggingInterceptor.Level.BODY 
      }
My app successfully runs. What are the reasons behind this?