title: Why are dex files being stored in my app's cache directory?
body: <p>I recently noticed that a lot of dex files (totaling over 40 MBs of data) are being stored in my app's cache directory. I find this unusual since a <a href="https://stackoverflow.com/questions/6760720/where-are-dex-files-located-after-apk-installation">quick search</a> shows that dex files should be stored in the <code>/data/dalvik-cache</code> directory and not the general app cache directory. </p>
  
  <p>I wanted to know why this is since:</p>
  
  <ol>
  <li>It is taking up a lot of space in my app's cache directory.</li>
  <li>My app sometimes needs to clear the cache directory and when it does so, the time it takes the app to startup again is increased drastically (10-20 seconds). Presumably because Android needs to recreate these dex files.</li>
  </ol>
  
  <p>Thank you in advance!</p>
  
  <p><strong>Update</strong></p>
  
  <p>My device is running <strong>Android 6.0.1</strong>. Here is an excerpt of my app's cache directory:</p>
  
  <pre><code>drwx------ u0_a178  u0_a178           2016-08-07 22:56 okhttp
  drwx------ u0_a178  u0_a178           2016-08-07 23:08 org.chromium.android_webview
  -rw-r--r-- u0_a178  u0_a178   1919104 2016-08-07 22:56 slice-MPAndroidChart-v2.2.4_756cc00da936eb4e219a44a244b55e2df68d07e2-classes.dex
  -rw-r--r-- u0_a178  u0_a178     74664 2016-08-07 22:56 slice-com.android.support-animated-vector-drawable-24.1.1_0eb7fa04565008cb6cbb1feab2ae0affa5250da4-classes.dex
  -rw-r--r-- u0_a178  u0_a178   2865992 2016-08-07 22:56 slice-com.android.support-appcompat-v7-24.1.1_ade323d4e3df1f7773864c565dd60eea04590c76-classes.dex
  -rw-r--r-- u0_a178  u0_a178    129848 2016-08-07 22:56 slice-com.android.support-cardview-v7-24.1.1_5a2590aaa21e69d85533742fbf35c4a80037594f-classes.dex
  -rw-r--r-- u0_a178  u0_a178   1266992 2016-08-07 22:56 slice-com.android.support-design-24.1.1_bae3a91de6040c93aed67ba25c118a1eb2cd63d0-classes.dex
  -rw-r--r-- u0_a178  u0_a178     67576 2016-08-07 22:56 slice-com.android.support-percent-24.1.1_eef44a28578a5bdac3ec7f4f8fe6db395b9242f5-classes.dex
  -rw-r--r-- u0_a178  u0_a178   1642120 2016-08-07 22:56 slice-com.android.support-recyclerview-v7-24.1.1_07c9cf9bb8d7da6bdbc7c7ce0e107b56362aa6e1-classes.dex
  -rw-r--r-- u0_a178  u0_a178   5368720 2016-08-07 22:56 slice-com.android.support-support-v4-24.1.1_3f84799af1c5ce5634d5302937609addc3d526de-classes.dex
  -rw-r--r-- u0_a178  u0_a178    245256 2016-08-07 22:56 slice-com.android.support-support-vector-drawable-24.1.1_183c04613849d18c534c9c96e5b5186bdf542d11-classes.dex
  -rw-r--r-- u0_a178  u0_a178    234976 2016-08-07 22:56 slice-com.crashlytics.sdk.android-answers-1.3.7_7d587ccfdb8d98904ff3416a950d4ca3d718fc04-classes.dex
  -rw-r--r-- u0_a178  u0_a178     76296 2016-08-07 22:56 slice-com.crashlytics.sdk.android-beta-1.1.5_2fa53876dc0fc447f8152c075ab46f0d8d92a816-classes.dex
  -rw-r--r-- u0_a178  u0_a178     45904 2016-08-07 22:56 slice-com.crashlytics.sdk.android-crashlytics-2.5.6_fb76c5554f0f0d4fc0a08ade7b64b0268ce17199-classes.dex
  -rw-r--r-- u0_a178  u0_a178    612144 2016-08-07 22:56 slice-com.crashlytics.sdk.android-crashlytics-core-2.3.9_2dff6f00a6ff1f48d87225bdaeac3553925a96a1-classes.dex
  -rw-r--r-- u0_a178  u0_a178   3565568 2016-08-07 22:56 slice-com.google.android.gms-play-services-ads-9.2.1_287b02684d9f21d460a20b44d7850ec566e57278-classes.dex
  -rw-r--r-- u0_a178  u0_a178   1664224 2016-08-07 22:56 slice-com.google.android.gms-play-services-ads-lite-9.2.1_ded75934ccfef925c6aa74ca2000dbc6904d5258-classes.dex
  -rw-r--r-- u0_a178  u0_a178   1233032 2016-08-07 22:56 slice-com.google.android.gms-play-services-base-9.2.1_359213862239d71bf62ed09377d593890ed8403c-classes.dex
  -rw-r--r-- u0_a178  u0_a178   3085656 2016-08-07 22:56 slice-com.google.android.gms-play-services-basement-9.2.1_70ce5ca57eb75287bd07834797967b46576d6fb7-classes.dex
  -rw-r--r-- u0_a178  u0_a178    223936 2016-08-07 22:56 slice-com.google.android.gms-play-services-clearcut-9.2.1_6c6330c827462491a41455b4ed9262ce276082a9-classes.dex
  -rw-r--r-- u0_a178  u0_a178     50472 2016-08-07 22:56 slice-com.google.android.gms-play-services-gass-9.2.1_1d2be8e71249040cb385274d0b324ea16d3879ec-classes.dex
  -rw-r--r-- u0_a178  u0_a178    102832 2016-08-07 22:56 slice-com.google.android.gms-play-services-tasks-9.2.1_922d581385edc6689dc58268229f0677eaa652ec-classes.dex
  -rw-r--r-- u0_a178  u0_a178    122848 2016-08-07 22:56 slice-disklrucache-2.0.2_a161adf664669683c31953160e5205319f8b5cd4-classes.dex
  -rw-r--r-- u0_a178  u0_a178    904856 2016-08-07 22:56 slice-gson-2.4_a6797fe63a0f01937ca151851d4933eb1f53d03b-classes.dex
  -rw-r--r-- u0_a178  u0_a178   1418992 2016-08-07 22:56 slice-internal_impl-24.1.1_1aa620cefcfc678e4b33946a0285c30664a7bc02-classes.dex
  -rw-r--r-- u0_a178  u0_a178   1018112 2016-08-07 22:56 slice-io.fabric.sdk.android-fabric-1.3.11_37c4b03d2dd42835d17319c32054c93008baf362-classes.dex
  -rw-r--r-- u0_a178  u0_a178   1405656 2016-08-07 22:56 slice-jsoup-1.9.2_5418f1f89f6018c691a8c003aa26c56de67bd7af-classes.dex
  -rw-r--r-- u0_a178  u0_a178   1557672 2016-08-07 22:56 slice-okhttp-3.3.0_3ce69bdb19c526170b282b56e8a73f9c77c74b9a-classes.dex
  -rw-r--r-- u0_a178  u0_a178    425616 2016-08-07 22:56 slice-okio-1.8.0_81dd90ec651c4bc7aa252b97e6338a5a365dcfb1-classes.dex
  -rw-r--r-- u0_a178  u0_a178     99104 2016-08-07 22:56 slice-org.apmem.tools-layouts-1.10_495a455557b5a529e5dfebcdc6a3bc57243903cb-classes.dex
  -rw-r--r-- u0_a178  u0_a178    186216 2016-08-07 22:56 slice-slice_0-classes.dex
  -rw-r--r-- u0_a178  u0_a178     28200 2016-08-07 22:56 slice-slice_1-classes.dex
  -rw-r--r-- u0_a178  u0_a178    541768 2016-08-07 22:56 slice-slice_2-classes.dex
  -rw-r--r-- u0_a178  u0_a178      8872 2016-08-07 22:56 slice-slice_3-classes.dex
  -rw-r--r-- u0_a178  u0_a178   1954440 2016-08-07 22:56 slice-slice_4-classes.dex
  -rw-r--r-- u0_a178  u0_a178   7168784 2016-08-07 23:08 slice-slice_5-classes.dex
  -rw-r--r-- u0_a178  u0_a178      8872 2016-08-07 22:56 slice-slice_6-classes.dex
  -rw-r--r-- u0_a178  u0_a178   3348288 2016-08-07 22:56 slice-slice_7-classes.dex
  -rw-r--r-- u0_a178  u0_a178    601304 2016-08-07 22:56 slice-slice_8-classes.dex
  -rw-r--r-- u0_a178  u0_a178     35224 2016-08-07 22:56 slice-slice_9-classes.dex
  -rw-r--r-- u0_a178  u0_a178     17064 2016-08-07 22:56 slice-support-annotations-24.1.1_b529bf0c82ba4e707c1b9be345d7c92d60cd7e8d-classes.dex
  </code></pre>