title: Failed resolution of: Landroid/arch/core/executor/AppToolkitTaskExecutor
body: <p>I'm currently trying to setup Room with Retrofit2. I would like to insert data from Retrofit2 into Room Database but the insertion doesn't work for me and the app crashed. I have implemented three Components using Room Library : entities, Dao and the Database.</p>
  
  <p>I have as Result this error.</p>
  
  <p><code>E/AndroidRuntime: FATAL EXCEPTION: main
                    Process: com.example.a694532.e_controlling, PID: 31841
                    java.lang.NoClassDefFoundError: Failed resolution of: Landroid/arch/core/executor/AppToolkitTaskExecutor;
                        at android.arch.persistence.room.InvalidationTracker.refreshVersionsAsync(InvalidationTracker.java:403)
                        at android.arch.persistence.room.RoomDatabase.endTransaction(RoomDatabase.java:219)
                        at com.example.a694532.e_controlling.data.db.dao.GareDao_Impl.insertGares(GareDao_Impl.java:116)
                        at com.example.a694532.e_controlling.service.repository.TotoRepository$1.onResponse(TotoRepository.java:106)
                        at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70)
                        at android.os.Handler.handleCallback(Handler.java:739)
                        at android.os.Handler.dispatchMessage(Handler.java:95)
                        at android.os.Looper.loop(Looper.java:158)
                        at android.app.ActivityThread.main(ActivityThread.java:7224)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.core.executor.AppToolkitTaskExecutor" on path: DexPathList[[zip file "/data/app/com.example.a694532.e_controlling-2/base.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.a694532.e_controlling-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.a694532.e_controlling-2/lib/arm, /vendor/lib, /system/lib]]
                        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                        at android.arch.persistence.room.InvalidationTracker.refreshVersionsAsync(InvalidationTracker.java:403) 
                        at android.arch.persistence.room.RoomDatabase.endTransaction(RoomDatabase.java:219) 
                        at com.example.a694532.e_controlling.data.db.dao.GareDao_Impl.insertGares(GareDao_Impl.java:116) 
                        at com.example.a694532.e_controlling.service.repository.TotoRepository$1.onResponse(TotoRepository.java:106) 
                        at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70) 
                        at android.os.Handler.handleCallback(Handler.java:739) 
                        at android.os.Handler.dispatchMessage(Handler.java:95) 
                        at android.os.Looper.loop(Looper.java:158) 
                        at android.app.ActivityThread.main(ActivityThread.java:7224) 
                        at java.lang.reflect.Method.invoke(Native Method) 
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                      Suppressed: java.lang.ClassNotFoundException: android.arch.core.executor.AppToolkitTaskExecutor
                        at java.lang.Class.classForName(Native Method)
                        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                              ... 13 more
                     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available</code></p>
  
  <p>Repository.class</p>
  
  <pre><code> @Singleton
  public class TotoRepository {
  
      //Converters
      private GareDtoConverter mGareConverter = new GareDtoConverter();
      private TrainDuJourDtoConverter mTrainDuJourConverter = new TrainDuJourDtoConverter();
  
      private TotoService totoService;
      private Executor executor;
      private GareDao gareDao;
      private TrainDao trainDao;
      private TronconDao tronconDao;
      GareEtTrainDuJour mGareEtTrain=new GareEtTrainDuJour();
  
      MyDatabase database;
  
      OkHttpClient okHttpClient = UnsafeOkHttpClient.getUnsafeOkHttpClient();
  
      public TotoRepository (Application application) {
          Gson gson = new GsonBuilder()
                  .setDateFormat("yyyy-MM-dd'T'HH:mm:ss")
                  .create();
          Retrofit.Builder builder = new Retrofit.Builder()
                  .baseUrl(EndPoint.TICKET)
                  .client(okHttpClient)
                  .addConverterFactory(GsonConverterFactory.create(gson));
          Retrofit retrofit = builder.build();
          totoService = retrofit.create(TotoService.class);
          database = MyDatabase.getInstance(application);
          gareDao=database.garesDao();
          trainDao=database.trainDao();
          tronconDao=database.tronconDao();
  
  
      }
  
      /*
      @Inject
      public TotoRepository(TotoService totoService, GareDao gareDao,TrainDao trainDao,TronconDao tronconDao, Executor executor) {
          this.totoService=totoService;
          this.gareDao=gareDao;
          this.trainDao=trainDao;
          this.tronconDao=tronconDao;
          this.executor = executor;
      }*/
  
  
  public GareEtTrainDuJour getGareEtTrainDuJour() {
      refreshGareEtTrainDuJour();
      // return a LiveData directly from the database.
      Log.d("loadFromDb","Recuperation des gares et trains du jours depuis la BD");
  
       mGareEtTrain.setGareList(gareDao.getGares());
       mGareEtTrain.setTrainList(trainDao.getTrains());
       mGareEtTrain.setTronconList(tronconDao.getTroncons());
  
       return mGareEtTrain;
  
  }
  
  
  
  
      public void refreshGareEtTrainDuJour(){
  
          totoService.garesEtTrainsDuJour().enqueue(new Callback&lt;GaresEtTrainsDuJourDTO&gt;() {
              @Override
              public void onResponse(Call&lt;GaresEtTrainsDuJourDTO&gt; call, Response&lt;GaresEtTrainsDuJourDTO&gt; response) {
  
                  gareDao.insertGares(mGareConverter.toModelList(response.body().getGares()));
                  Map&lt;String, Gare&gt; listNameGare = mGareConverter.myListMapper(mGareConverter.toModelList(response.body().getGares()));
                  trainDao.insertOrReplaceTrains(mTrainDuJourConverter.toTrainModelList(response.body().getTrains(),listNameGare));
                  Log.d("RBRBRBRBRB",mTrainDuJourConverter.toTrainModelList(response.body().getTrains(),listNameGare).toString());
  
  
              }
  
              @Override
              public void onFailure(Call&lt;GaresEtTrainsDuJourDTO&gt; call, Throwable t) {
                  Log.d("RBRBRBRBRBFFFF",t.getCause().toString());
                  Log.d("RBRBRBRBRBFFFF",t.toString());
                  t.printStackTrace();
  
  
  
              }
          });
      }
  
  }
  </code></pre>
  
  <p>ViewModel.class</p>
  
  <pre><code>public class TotoViewModel extends AndroidViewModel {
  
  private GareEtTrainDuJour mGareEtTrain;
  private TotoRepository totoRepo;
  
  @Inject
  public TotoViewModel(Application application) {
      super(application);
      totoRepo=new TotoRepository(application);
  }
  
  public void init() {
      mGareEtTrain=totoRepo.getGareEtTrainDuJour();
  }
  
  
  
  public GareEtTrainDuJour getGaresTrain() {
      return this.mGareEtTrain;
  }
  </code></pre>
  
  <p>}</p>