title: "Resolved" Retrofit with Kotlin does not trigger enqueue
body: <p>[Please check the update 2]</p>
  
  <p>I'm trying to implement retrofit with Kotlin. Please look at the following code:</p>
  
  <p>Here is the main retrofit method which should get the user from API(Webservice):</p>
  
  <pre><code>const val BASE_URL = "https://jsonplaceholder.typicode.com"
  
  fun getUser(userId: Int){
      val loggingInterceptor = HttpLoggingInterceptor()
      loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
      val client = OkHttpClient.Builder()
          .connectTimeout(60, TimeUnit.SECONDS)
          .writeTimeout(60, TimeUnit.SECONDS)
          .readTimeout(60, TimeUnit.SECONDS)
          .addInterceptor(loggingInterceptor)
          .build()
  
      val retrofit = Retrofit.Builder()
          .baseUrl(BASE_URL)
          .client(client)
          .addConverterFactory(GsonConverterFactory.create())
          .build()
  
       val user = retrofit.create(Api::class.java)
  
          val userObject : Call&lt;ResponseBody&gt; =  user.getUser(userId)
  
          userObject.enqueue(object : Callback&lt;ResponseBody&gt;{
              override fun onFailure(call: Call&lt;ResponseBody&gt;, t: Throwable) {
                  e(javaClass.simpleName, "loginResponse: $call")
                  e(javaClass.simpleName, "loginResponse: ${t.printStackTrace()}")
              }
  
              override fun onResponse(call: Call&lt;ResponseBody&gt;, response: Response&lt;ResponseBody&gt;) {
                  e(javaClass.simpleName, "loginResponse: ${response.raw()}")
                  e(javaClass.simpleName, "loginResponse: ${response.code()}")
                  e(javaClass.simpleName, "loginResponse: ${response.message()}")
              }
  
          })
  
  }
  </code></pre>
  
  <p>Api interface:</p>
  
  <pre><code>interface Api {
  
      @GET("users/{id}")
      fun getUser(
          @Path("id") id: Int
      ): Call&lt;ResponseBody&gt;
  }
  </code></pre>
  
  <p>Now the issue is with the callback method of enqueue, onResponse and onFailure does not print any logs. But I get the logs the Http request is successful from OkHttpClient. If I use equivalent java code everything works just fine. I've spent an entire day searching for the solution. and tried different approaches, but nothing seems to work. Any help would be much appreciated. </p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>For now, I'm using it's equivalent Java code as follows which works great:</p>
  
  <pre><code>    userObject.enqueue(new Callback&lt;ResponseBody&gt;() {
          @Override
          public void onResponse(@NotNull Call&lt;ResponseBody&gt; call, @NotNull Response&lt;ResponseBody&gt; response) {
              e(TAG, "loginResponse: " + call);
              e(TAG, "loginResponse: " + response.string());
  
          }
  
          @Override
          public void onFailure(@NotNull Call&lt;ResponseBody&gt; call, @NotNull Throwable t) {
              e(TAG, "loginResponse: " + call);
              e(TAG, "loginResponse: ", t);
          }
      });
  </code></pre>
  
  <p>Though I'm keeping this question unresolved, somebody might find/know a solution for it. Or If I find it in future I'll update it.</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>It was a silly mistake, or I can't even say it was a mistake. Actually what happened is logs were not getting printed from those methods. But when I put Toast inside those methods, it displayed the toast with the response.</p>
  
  <p><strong>So, I learned that Android Logs are not always reliable, so when you're stuck with the logs, always try and use toasts or interface methods. So this is the answer to my question.</strong> </p>
  
  <p>But anybody could tell me why those logs didn't print, that would be very helpful too.</p>