title: Why is there an error java.lang.ExceptionInInitializerError when using an ImageSlider in a recyclerView in Kotlin?
body: <p>I am trying to show images in an <code>ImageSlider</code> in a recyclerView. What I have done is, as the images to be fetched from <code>Firebase</code> storage, I created an array of SlideModel within the adapter class. There will be a minimum of 1 and a maximum of 5 images. Following is how I have done this.</p>
  <p>My code seems to work as I can see data in the remoteImages (SlideModel ArrayList) in the <code>Logcat</code>. But, when I add the last line of code, which is <code>holder.itemView.image_slider.setImageList(remoteImages, ScaleTypes.FIT)</code>, my app crashes with the  following error. Without it, the app works fine but there are no images in the slider.</p>
  <pre><code>    java.lang.ExceptionInInitializerError
      at okhttp3.internal.platform.Platform.get(Platform.java:85)
      at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
      at okhttp3.OkHttpClient.&lt;init&gt;(OkHttpClient.java:229)
      at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:1015)
      at com.squareup.picasso.OkHttp3Downloader.&lt;init&gt;(OkHttp3Downloader.java:71)
      at com.squareup.picasso.OkHttp3Downloader.&lt;init&gt;(OkHttp3Downloader.java:50)
      at com.squareup.picasso.OkHttp3Downloader.&lt;init&gt;(OkHttp3Downloader.java:40)
      at com.squareup.picasso.Picasso$Builder.build(Picasso.java:848)
      at com.squareup.picasso.Picasso.get(Picasso.java:683)
      at com.denzcoskun.imageslider.adapters.ViewPagerAdapter.instantiateItem(ViewPagerAdapter.kt:71)
      at com.denzcoskun.imageslider.adapters.ViewPagerAdapter.instantiateItem(ViewPagerAdapter.kt:25)
      at androidx.viewpager.widget.ViewPager.addNewItem(ViewPager.java:1010)
      at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1158)
      at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092)
      at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1622)
      at android.view.View.measure(View.java:27131)
      at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
      at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
      at android.view.View.measure(View.java:27131)
  </code></pre>
  <p>I have <code>implementation 'com.github.denzcoskun:ImageSlideshow:0.1.0'</code> in my <code>build.gradle</code></p>
  <p>Following is the <code>XML</code> code for the <code>ImageSlider</code> which is a part of my itemlayout for the recyclerView.</p>
  <pre><code>    &lt;com.denzcoskun.imageslider.ImageSlider
      android:id=&quot;@+id/image_slider&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;200dp&quot;
      app:iss_auto_cycle=&quot;true&quot;
      app:iss_period=&quot;2500&quot;
      app:iss_delay=&quot;0&quot;/&gt;
  </code></pre>
  <p>Following is part of my <code>ItemListAdapter.kt</code>.</p>
  <pre><code>    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
          val model = list[position]
  
          val numOfImages = model.image_count
          val remoteImages: ArrayList&lt;SlideModel&gt; = ArrayList()
  
  
          if (holder is MyViewHolder) {
  
              when (numOfImages) {
                  1 -&gt; {
                      
                      remoteImages.add(
                          SlideModel(
                              model.image,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      Log.d(&quot;TAG&quot;, remoteImages.toString())
                      Log.d(&quot;TAG&quot;, remoteImages.size.toString())
                  }
                  2 -&gt; {
                     
                      remoteImages.add(
                          SlideModel(
                              model.image,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image2,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      Log.d(&quot;TAG&quot;, remoteImages.toString())
                      Log.d(&quot;TAG&quot;, remoteImages.size.toString())
                  }
                  3 -&gt; {
                      remoteImages.add(
                          SlideModel(
                              model.image,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image2,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image3,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      Log.d(&quot;TAG&quot;, remoteImages.toString())
                      Log.d(&quot;TAG&quot;, remoteImages.size.toString())
                  }
                  4 -&gt; {
                      remoteImages.add(
                          SlideModel(
                              model.image,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image2,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image3,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image4,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      Log.d(&quot;TAG&quot;, remoteImages.toString())
                      Log.d(&quot;TAG&quot;, remoteImages.size.toString())
                  }
                  5 -&gt; {
                      remoteImages.add(
                          SlideModel(
                              model.image,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image2,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image3,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image4,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      remoteImages.add(
                          SlideModel(
                              model.image5,
                              model.title,
                              ScaleTypes.FIT
                          )
                      )
  
                      Log.d(&quot;TAG&quot;, remoteImages.toString())
                      Log.d(&quot;TAG&quot;, remoteImages.size.toString())
                  }
                  else -&gt; {
                      Log.d(&quot;TAG&quot;, &quot;There are no images&quot;)
                  }
              }
  
  holder.itemView.image_slider.setImageList(remoteImages, ScaleTypes.FIT)
  
      }
  </code></pre>