title: Kotlin: Expression can't be invoked because function invoke() is not found
body: <p>I'm trying to build an app where I implement Google maps. for some reason I get the error that the expression can't be invoked because the function invoke() is not found. I don't know how to fix this maybe one of you guys can help?</p>
  
  <pre><code>    package com.example.maxs.kotlinnearbyv2
  
  import android.support.v7.app.AppCompatActivity
  import android.os.Bundle
  import android.util.Log
  import android.widget.Toast
  import com.example.maxs.kotlinnearbyv2.Common.Common
  import com.example.maxs.kotlinnearbyv2.Model.MyPlaces
  import com.example.maxs.kotlinnearbyv2.Remote.IGoogleAPIService
  import com.google.android.gms.maps.*
  import com.google.android.gms.maps.model.BitmapDescriptorFactory
  
  import com.google.android.gms.maps.model.LatLng
  import com.google.android.gms.maps.model.MarkerOptions
  import kotlinx.android.synthetic.main.activity_maps.*
  import retrofit2.Call
  import retrofit2.Callback
  import retrofit2.Response
  
  class MapsActivity : AppCompatActivity(), OnMapReadyCallback {
  
  private lateinit var mMap: GoogleMap
  
  private var latitude:Double=0.toDouble()
  private var longitude:Double=0.toDouble()
  
  lateinit var mService:IGoogleAPIService
  
  internal var currentPlace: MyPlaces?=null
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_maps)
      // Obtain the SupportMapFragment and get notified when the map is ready to be used.
      val mapFragment = supportFragmentManager
          .findFragmentById(R.id.map) as SupportMapFragment
      mapFragment.getMapAsync(this)
  
      //Init Service
      mService = Common.googleApiService
  
      bottom_navigation_view.setOnNavigationItemReselectedListener {item -&gt;
          when(item.itemId)
          {
              R.id.action_hospital -&gt; nearByPlace("hospital")
              R.id.action_restaurant -&gt; nearByPlace("restaurant")
              R.id.action_market -&gt; nearByPlace("market")
              R.id.action_school -&gt; nearByPlace("school")
          }
      }
  }
  
  private fun nearByPlace(typePlace: String) {
  
      //Clear all marker on Map
      mMap.clear()
      //build URL request base on location
      val url = getUrl(latitude,longitude, typePlace)
  
      mService.getNearByPlaces(url)
          .enqueue(object : Callback&lt;MyPlaces&gt;{
              override fun onResponse(call: Call&lt;MyPlaces&gt;, response: Response&lt;MyPlaces&gt;) {
  
                  currentPlace = response.body()
  
                  if(response!!.isSuccessful)
                  {
                      for(i in 0 until response!!.body()!!.results!!.size)
                      {
                          val markerOptions=MarkerOptions()
                          val googlePlace = response.body().results!!(i)
                          val lat = googlePlace.geometry!!.location!!.lat
                          val lng = googlePlace.geometry!!.location!!.lng
                          val placeName = googlePlace.name
                          val latLng = LatLng(lat, lng)
  
                          markerOptions.position(latLng)
                          markerOptions.title(placeName)
                          if (typePlace.equals("hospital"))
                              markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_local_hospital_black_24dp))
                          else if (typePlace.equals("market"))
                              markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_shopping_cart_black_24dp))
                          else if (typePlace.equals("restaurant"))
                              markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_restaurant_black_24dp))
                          else if (typePlace.equals("school"))
                              markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_school_black_24dp))
                          else
                              markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE))
  
                          markerOptions.snippet(i.toString())
  
                          //add marker to map
                          mMap!!.addMarker(markerOptions)
  
  
                      }
                      //move camera
                      mMap!!.moveCamera(CameraUpdateFactory.newLatLng(LatLng(latitude, longitude)))
                      mMap!!.animateCamera(CameraUpdateFactory.zoomTo(15.0f))
                  }
              }
  
              override fun onFailure(call: Call&lt;MyPlaces&gt;, t: Throwable) {
                  Toast.makeText(baseContext, ""+t!!.message,Toast.LENGTH_SHORT).show()
              }
  
          })
  }
  
  private fun getUrl(latitude: Double, longitude: Double, typePlace: String): String {
  
      val googlePlaceUrl = StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json")
      googlePlaceUrl.append("?location=$latitude,$longitude")
      googlePlaceUrl.append("&amp;radius=10000") //10 km
      googlePlaceUrl.append("&amp;type=$typePlace")
      googlePlaceUrl.append("&amp;key=")
  
      Log.d("URL_DEBUG", googlePlaceUrl.toString())
      return googlePlaceUrl.toString()
  }
  
  /**
   * Manipulates the map once available.
   * This callback is triggered when the map is ready to be used.
   * This is where we can add markers or lines, add listeners or move the camera. In this case,
   * we just add a marker near Sydney, Australia.
   * If Google Play services is not installed on the device, the user will be prompted to install
   * it inside the SupportMapFragment. This method will only be triggered once the user has
   * installed Google Play services and returned to the app.
   */
  override fun onMapReady(googleMap: GoogleMap) {
      mMap = googleMap
  
      // Add a marker in Sydney and move the camera
      val barbier = LatLng(52.391274, 6.449712)
      mMap.addMarker(MarkerOptions().position(barbier).title("Marker in Barbier"))
      mMap.moveCamera(CameraUpdateFactory.newLatLng(barbier))
      mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(barbier, 15.0f))
  }
  }
  </code></pre>
  
  <p>I can't seem to find any solution and i'm probably think way to difficult…
  the error is giving at the response.body()!!.results!!(i)</p>
  
  <pre><code>val googlePlace = response.body().results!!(i)
  </code></pre>
  
  <p>it sure is driving me crazy right now.</p>