The specified SD image file must be a valid image file

Issue

I’ve been following the setup guide for flutter on https://flutter.dev/docs/get-started/install/windows. I am at the "Set up the Android emulator" step. I’ve followed the instructions but I am unable to run the emulator that I set up. When I click on the run option I get the following error:

AVD manager emulator process was killed.

I’ve read that this might be due to the Android Studio trying to allocate a space larger than the available size. In order to confirm this, I clicked the "Edit this AVD" option in the "Android Virtual Device Manager".

edit this avd

Then, I saw that this configuration was trying to use 6144 MB when I had only 4.02 GB available on my C drive (my D drive has more than 800 GB of space but I don’t know how to tell Android Studio to use it instead). I attempted to change this to 2000 MB but the program doesn’t let me save the configuration due to this error, "The specified SD image file must be a valid image file":

sd image error

I don’t know how to get rid of this. Can someone help?

Edit: After changing my hard drive to a 1 TB one and redoing the setup process for the flutter following https://flutter.dev/docs/get-started/install/windows, I was able to solve the problem. So, it seems that as Swaminathan V mentioned, there must be available space in C: no matter what. From what I’ve read, upwards of 7 GB seems to work for the most people.

Solution

To use the external image you need to create a new image with the
mksdcard tool available with the Android SDK.

Follow the below steps to generate and use it in the AVD.

Open the tools directory under Android SDK directory (android-sdk) in cmd or powershell or terminal.

<<PATH TO ANDROID ROOT DIRECTORY>>\tools>_     // Example : C:\android-sdk\tools>

Then execute the following command to create a image for SD card with desired size.

Syntax : mksdcard size destinationFile

Example : C:\android-sdk\tools> mksdcard 4096M D:\sample.img

The above command will create a image file of size 4GB under the D drive.

enter image description here

Now use it in your emulator config.

enter image description here

NOTE : The size should be mentioned in MB. Minimum allowed size is 9MB and Max allowed size is 1023 GB. Please refer Android official doc for more details.

Answered By – Swaminathan V

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published