title: Android emulator cannot format SD card: failed with '400 10 Command failed'
body: <p>I'm using Android Studio 2.3.3, Android SDK tools v26.0.2, and HAXM emulator 6.2.1. </p>
  
  <p>edit (update 2017/11/10): Also tried with Android Studio 3.0, Android SDK tools 27.0.1, HAXM emulator 6.2.1, x86 Google Play Intel API 27 image revision 1.</p>
  
  <p>I downloaded the Android 8.0 (O, API level 26, revision 2) platform and created a new emulator:</p>
  
  <p>Create->Phone->Nexus 5X with Play Store support->Image x86 API 26 (Google Play), standard settings:</p>
  
  <p><img src="https://imgur.com/ymMFHP6.jpg"/></p>
  
  <p>After booting the emulator, I get a message in the notification tray that tells me "Unsupported Virtual SD card. This device doesn't support this Virtual SD card. Tap to set up in a supported format."</p>
  
  <p><img src="https://imgur.com/t1lrUNL.jpg"/></p>
  
  <p>I do that, and choose either internal or external storage, and then I get the error:</p>
  
  <p><img src="https://imgur.com/0Iz5btB.jpg"/></p>
  
  <pre><code>10-09 13:31:59.786 2984-2984 E/StorageSettings:  Failed to partition
  java.lang.IllegalStateException: command '10 volume partition disk:253,48 public' failed with '400 10 Command failed'
  </code></pre>
  
  <p>Full error and everything around it:</p>
  
  <pre><code>10-09 13:31:58.397 1506-1594 E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
  10-09 13:31:58.566 2984-3021 D/EGL_emulation: eglMakeCurrent: 0xa1a99fe0: ver 2 0 (tinfo 0xa1d7f920)
  10-09 13:31:58.608 1356-1356 D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 4096
  10-09 13:31:58.731 1506-2285 I/ActivityManager: START u0 {cmp=com.android.settings/.deviceinfo.StorageWizardFormatProgress (has extras)} from uid 1000
  10-09 13:31:58.753 1506-1519 E/memtrack: Couldn't load memtrack module
  10-09 13:31:58.753 1506-1519 W/android.os.Debug: failed to get memory consumption info: -1
  10-09 13:31:58.775 1506-1655 D/VoldConnector: SND -&gt; {10 volume partition disk:253,48 public}
  10-09 13:31:58.775 1310-1314 V/vold: /system/bin/sgdisk
  10-09 13:31:58.775 1310-1314 V/vold:     --zap-all
  10-09 13:31:58.775 1310-1314 V/vold:     /dev/block/vold/disk:253,48
  10-09 13:31:58.779 1310-1314 I/sgdisk: Creating new GPT entries.
  10-09 13:31:58.790 1356-1356 D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 4096
  10-09 13:31:58.795 1356-1356 I/chatty: uid=1000(system) allocator@2.0-s identical 1 line
  10-09 13:31:58.800 1356-1356 D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 4096
  
  
                                                 [ 10-09 13:31:58.807  2984: 3021 D/         ]
                                                 SurfaceInterface::setAsyncMode: set async mode 1
  10-09 13:31:58.812 2984-3021 D/EGL_emulation: eglMakeCurrent: 0xa1a99fe0: ver 2 0 (tinfo 0xa1d7f920)
  10-09 13:31:58.819 1506-1527 I/ActivityManager: Displayed com.android.settings/.deviceinfo.StorageWizardFormatProgress: +67ms
  10-09 13:31:58.821 2984-3021 D/EGL_emulation: eglMakeCurrent: 0xa1a99fe0: ver 2 0 (tinfo 0xa1d7f920)
  10-09 13:31:58.829 2984-3021 D/EGL_emulation: eglMakeCurrent: 0xa1a99fe0: ver 2 0 (tinfo 0xa1d7f920)
  10-09 13:31:58.839 2984-3021 D/OpenGLRenderer: endAllActiveAnimators on 0xa1d0da00 (RippleDrawable) with handle 0xa19fd2e0
  10-09 13:31:59.784 1310-1314 I/sgdisk: GPT data structures destroyed! You may now partition the disk using fdisk or
  10-09 13:31:59.785 1310-1314 I/sgdisk: other utilities.
  10-09 13:31:59.785 1310-1314 E/config_mbr: Not enough space to add parttion 'android_sdcard'.
  10-09 13:31:59.785 1310-1314 E/diskconfig: Configuration is invalid.
  10-09 13:31:59.785 1310-1314 E/vold: Failed to apply disk configuration: 1
  10-09 13:31:59.785 1506-1565 D/VoldConnector: RCV &lt;- {400 10 Command failed}
  10-09 13:31:59.785 1506-1655 E/VoldConnector: NDC Command {10 volume partition disk:253,48 public} took too long (1010ms)
  10-09 13:31:59.786 2984-2984 E/StorageSettings: Failed to partition
                                                  java.lang.IllegalStateException: command '10 volume partition disk:253,48 public' failed with '400 10 Command failed'
                                                      at android.os.Parcel.readException(Parcel.java:1950)
                                                      at android.os.Parcel.readException(Parcel.java:1888)
                                                      at android.os.storage.IStorageManager$Stub$Proxy.partitionPublic(IStorageManager.java:1865)
                                                      at android.os.storage.StorageManager.partitionPublic(StorageManager.java:878)
                                                      at com.android.settings.deviceinfo.StorageWizardFormatProgress$PartitionTask.doInBackground(StorageWizardFormatProgress.java:118)
                                                      at com.android.settings.deviceinfo.StorageWizardFormatProgress$PartitionTask.doInBackground(StorageWizardFormatProgress.java:93)
                                                      at android.os.AsyncTask$2.call(AsyncTask.java:333)
                                                      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                                                      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
                                                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
                                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
                                                      at java.lang.Thread.run(Thread.java:764)
  </code></pre>
  
  <p>I have tried deleting and re-creating this image, updating Android Studio, updating Android Tools, and updating the SDKs. This works fine with API 23 and 24 emulators. Has anyone seen this before or have any ideas of things I can try?</p>