title: Accessing hidden method Ljava/lang/Thread;->getUncaughtExceptionPreHandler()Ljava/lang/Thread$UncaughtExceptionHandler; (light greylist, reflection)
body: <p>I use kotlin Coroutines &amp; retrofit in my project. Sometimes my app crashes with this error </p>
  
  <pre><code>Accessing hidden method Ljava/lang/Thread;-&gt;getUncaughtExceptionPreHandler()Ljava/lang/Thread$UncaughtExceptionHandler; (light greylist, reflection)
  </code></pre>
  
  <p>I couldn't understand what is happening.</p>
  
  <p>My ViewModel :</p>
  
  <pre><code> private val parentJob = SupervisorJob()
  
      private val coroutineContext: CoroutineContext
          get() = parentJob + Dispatchers.Default
  
  
      private val scope = CoroutineScope(coroutineContext)
  
      private val repository: RegisterRepository = RegisterRepository(service)
  
  
     scope.launch {
              val registerResult = repository.postRegister(registerBody)
  
              if (registerResult != null) {
                  authToken = "${registerResult[0].token_type}  ${registerResult[0].access_token}"
                  SharedPref.write(AUTH_TOKEN, "$authToken")
              }
  
              registerResponse.postValue(registerResult)
          }
  </code></pre>
  
  <p>The Repository Class</p>
  
  <pre><code>suspend fun postRegister(registerBody: RegisterBody): MutableList&lt;RegisterResponse&gt;? {
  
          val response = safeApiCall(
              call = { api.register(registerBody).await() },
              errorMessage = "Error posting register data"
          )
  
  
          return response!!.data!!.toMutableList()
  
      }
  </code></pre>