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:
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".
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":
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.
To use the external image you need to create a new image with the
mksdcardtool available with the Android SDK.
Follow the below steps to generate and use it in the AVD.
tools directory under Android SDK directory (
<<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.
mksdcard size destinationFile
C:\android-sdk\tools> mksdcard 4096M D:\sample.img
The above command will create a image file of size 4GB under the D drive.
Now use it in your emulator config.
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