title: Android: kotlin synthetic import crashes even if id is present in layout
body: <p>I am new to Kotlin and in my project I am using kotlins synthetic import feature. It is crashing sometimes throwing KotlinNullPointerException. Here is log:</p>
  
  <pre><code>Fatal Exception: kotlin.KotlinNullPointerException
     at main.fragments.ListingDetailsFragment$getProductComboData$responseListener$1.onResponse(ListingDetailsFragment.kt:1607)
     at main.fragments.ListingDetailsFragment$getProductComboData$responseListener$1.onResponse(ListingDetailsFragment.kt:159)
     at com.android.volley.toolbox.JsonRequest.deliverResponse(JsonRequest.java:83)
     at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:106)
     at android.os.Handler.handleCallback(Handler.java:790)
     at android.os.Handler.dispatchMessage(Handler.java:99)
     at android.os.Looper.loop(Looper.java:187)
     at android.app.ActivityThread.main(ActivityThread.java:7025)
     at java.lang.reflect.Method.invoke(Method.java)
     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:514)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888)
  </code></pre>
  
  <p>Code at line no. 1607:</p>
  
  <pre><code>lin_product_combo!!.visibility = View.GONE
  </code></pre>
  
  <p>This happening after webservice call. Below is the function:</p>
  
  <pre><code>private fun getProductComboData() {
      val params = HashMap&lt;String, String&gt;()
      params["listing_id"] = listingId
      params["category_id"] = listingDetailsModel!!.category_id
      params["condition"] = listingDetailsModel!!.condition
      params["location"] = listingDetailsModel!!.location
  
      val responseListener = Response.Listener&lt;JSONObject&gt; { response -&gt;
                      try {
              val code = response.getString("code")
              if (code.equals("success", ignoreCase = true)) {
                  val data = response.optJSONObject("data")
                  if (data != null) {
                      productComboModels!!.clear()
                      if (data.has("currentLid") &amp;&amp; data.get("currentLid") is JSONObject) {
                          val currentLidObj = data.getJSONObject("currentLid")
                          val recommendateDataArray = data.getJSONArray("recommendateData")
                          if (recommendateDataArray != null) {
                              val size = recommendateDataArray.length()
                              if (size &gt; 0) {
                                  val currentLidModel = BuyListingsModel.getBuyListingModel(currentLidObj)
                                  currentLidModel.isItemSelected = true
                                  productComboModels!!.add(currentLidModel)
                                  for (i in 0 until size) {
                                      val recommendedDataModel = BuyListingsModel
                                              .getBuyListingModel(recommendateDataArray.optJSONObject(i))
                                      recommendedDataModel.isItemSelected = true
                                      productComboModels!!.add(recommendedDataModel)
                                  }
                              }
                          }
                      }
                      if (!productComboModels!!.isEmpty()) {
                          frequently_bought_together_title!!.visibility = View.VISIBLE
                          lin_product_combo!!.visibility = View.VISIBLE
                          productComboAdapter!!.notifyDataSetChanged()
                          total_combo_price!!.text = Util
                                  .formatCurrencyToRupees(productComboPrice.toString())
                      } else {
                          lin_product_combo!!.visibility = View.GONE
                      }
                  }
              } else if (code.equals("failed", ignoreCase = true)) {
                  handleError(response)
              }
          } catch (e: JSONException) {
              e.printStackTrace()
          }
      }
  
      val errorListener = Response.ErrorListener { error -&gt; error.printStackTrace() }
      comboAPICalled = true
      Api.getFrequentlyBoughtTogetherData(params, responseListener, errorListener)
  }
  </code></pre>
  
  <p>These are import statements:</p>
  
  <pre><code>import kotlinx.android.synthetic.main.certification_package_eco_layout.*
  import kotlinx.android.synthetic.main.certification_package_history_layout.*
  import kotlinx.android.synthetic.main.certification_packages_locked_section.*
  import kotlinx.android.synthetic.main.fragment_listing_details_v2.*
  import kotlinx.android.synthetic.main.fragment_listing_details_v2.view.*
  import kotlinx.android.synthetic.main.layout_discovery_tools_view.*
  import kotlinx.android.synthetic.main.layout_fcts_panel.* 
  import kotlinx.android.synthetic.main.layout_tco_value_view.*
  import kotlinx.android.synthetic.main.ldp_listing_summary_layout.*
  import kotlinx.android.synthetic.main.pay_token_amount_layout.*
  import kotlinx.android.synthetic.main.product_detail_seller_panel.*
  import kotlinx.android.synthetic.main.service_date_time_panel.*
  </code></pre>
  
  <p>And lin_product_combo is a linear layout that is present in the xml file. Not getting idea for null pointer exception. Same happened for some pther views too.</p>