title: Fatal Exception OkHttp Dispatcher with RetroFit
body: <p>I am using RetroFit to make a call to <a href="https://developers.themoviedb.org/3/movies/get-popular-movies" rel="nofollow noreferrer">TheMovieDatabase API</a> and am trying to get a list of the popular movies to populate into a <code>RecylerView</code>. However, when I make the call through RetroFit, I am getting an error related to OkHTTP. I am using OkHTTP in conjunction with RetroFit:</p>
  
  <pre><code>06-08 19:57:26.281 19232-19254/popularmovies.troychuinard.com.popularmovies E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
      Process: popularmovies.troychuinard.com.popularmovies, PID: 19232
      java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Platform;
          at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:112)
          at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:160)
          at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
          at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
          at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
          at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147)
          at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
          at java.lang.Thread.run(Thread.java:761)
       Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.internal.Platform" on path: DexPathList[[zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/base.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_dependencies_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_0_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_1_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_2_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_3_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_4_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_5_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_6_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_7_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_8_apk.apk", zip file "/data/app/popularmovies.troychuinard.com.popularmovies-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/popularmovies.troychuinard.com.popularmovies-2/lib/arm, /system/lib, /vendor/lib]]
          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
          at okhttp3.logging.HttpLoggingInterceptor$Logger$1.log(HttpLoggingInterceptor.java:112) 
          at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:160) 
          at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) 
          at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) 
          at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) 
          at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147) 
          at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
          at java.lang.Thread.run(Thread.java:761) 
  </code></pre>
  
  <p>Below is my relevant code from RetroFit:</p>
  
  <pre><code>spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
              Toast.makeText(getApplicationContext(), String.valueOf(i), Toast.LENGTH_LONG).show();
              String selection = String.valueOf(i);
              switch (i){
                  case 0:
                      query = "popular";
                      mBaseURL = "https://api.themoviedb.org/3/movie/popular/";
                      break;
                  case 1:
                      query = "top_rated";
                      mBaseURL = "https://api.themoviedb.org/3/movie/top_rated/";
                      break;
                  default:
                      query = "popular";
                      mBaseURL = "https://api.themoviedb.org/3/movie/popular/";
                      break;
              }
              mMovieURLS.clear();
              mMovieResultsAdapter.notifyDataSetChanged();
              HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
              interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
              OkHttpClient client = new OkHttpClient
                      .Builder()
                      .addInterceptor(interceptor)
                      .build();
  
              Retrofit retrofit = new Retrofit.Builder()
                      .baseUrl(mBaseURL)
                      .client(client)
                      .addConverterFactory(GsonConverterFactory.create())
                      .build();
  
              ApiInterface apiInterface = retrofit.create(ApiInterface.class);
              Call&lt;TheMovieDatabase&gt; call = apiInterface.getImages();
              call.enqueue(new Callback&lt;TheMovieDatabase&gt;() {
                  @Override
                  public void onResponse(Call&lt;TheMovieDatabase&gt; call, Response&lt;TheMovieDatabase&gt; response) {
                      String movieResponse = String.valueOf(response.isSuccessful());
                      Log.v("SUCESS", movieResponse);
                  }
  
                  @Override
                  public void onFailure(Call&lt;TheMovieDatabase&gt; call, Throwable t) {
  
                  }
              });
          }
  </code></pre>
  
  <p>API InterFace:</p>
  
  <pre><code>    public interface ApiInterface{
      @GET("?api_key=xxxxxxxxx&amp;language=en-US")
      Call&lt;TheMovieDatabase&gt; getImages();
  }
  </code></pre>
  
  <p>Gradle Dependencies:</p>
  
  <pre><code>dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.android.support:appcompat-v7:27.1.1'
  implementation 'com.android.support.constraint:constraint-layout:1.1.0'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  implementation 'com.squareup.picasso:picasso:2.5.2'
  implementation 'com.android.support:recyclerview-v7:27.1.1'
  implementation 'com.squareup.retrofit2:retrofit:2.4.0'
  implementation 'com.squareup.okhttp3:okhttp:3.10.0'
  implementation 'com.google.code.gson:gson:2.8.2'
  implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
  implementation 'com.squareup.okhttp3:logging-interceptor:3.3.0'
  }
  </code></pre>