Question

I've installed JDK, Android SDK and Mono Android for Visual Studio 2010, I've created an empty solution and I got the emulator up and running with Android 2.3.3 - so far so good.

When I try to deploy (F5) the app to the emulator, it connects to the emulator, and all goes fine until it starts "Installing the platform framework". Then it loads for several minutes, and finally throws an exception that looks like this:

enter image description here

I have tried googlin' it, but the INSTALL_FAILED_MEDIA_UNAVAILABLE doesn't seem to be described anywhere else.

I don't know if this is an important detail, but on my PC I have remapped my home folders (Documents, Favorites, Desktop, etc.) to folders like "D:\Mikkel\Dokumenter". It seemed to cause some problems when starting the emulator initially, but after adding the environment variable "ANDROID_SDK_HOME" pointing to "D:\Mikkel.android" the emulator started up with no problems.

Please advise.

Was it helpful?

Solution 5

I've solved the problem - it seems that if you close the (weird) empty DOS prompt that opens when the emulator is started, the connection to the emulator is lost.

Leaving the DOS window open, everything works like a charm.

OTHER TIPS

Ensure that you have enough internal and external free space in your device. You can determine the free space available with the command:

$ adb shell df
Filesystem             Size   Used   Free   Blksize
/dev                   192M    32K   192M   4096
/mnt/asec              192M     0K   192M   4096
/mnt/obb               192M     0K   192M   4096
/system                145M   124M    20M   4096
/data                  196M   167M    29M   4096
/cache                  95M    32M    62M   4096
/mnt/sdcard              3G   177M     3G   32768

In the above output, /data (which is the default install location) has 29MB free, while /mnt/sdcard (the SD card, and the external install location) has 3GB free.

For Debug builds, you need to have ~40MB free (for the Runtime package, Platform package, and apps). Release builds are significantly smaller, but Release builds cannot be created with the Evaluation version.

It's plausible that if your emulator doesn't have an SD card, then Android would generate the INSTALL_FAILED_MEDIA_UNAVAILABLE error. (To add an SD card to your emulator, start the android app, go to Virtual devices, select a device, click Edit, and look at the SD Card section.)

A cursory grepping of Android suggests that DefaultContainerService.java is the controlling factor, specifically DefaultContainerService.recommendAppInstallLocation(), and that if you're out of internal space and the package specifies auto (as Mono for Android does) and the SD card is unavailable (status.equals(Environment.MEDIA_MOUNTED) is false), then RECOMMEND_MEDIA_UNAVAILABLE is returned, which is translated into INSTALL_FAILED_MEDIA_UNAVAILABLE. This still seems odd to me (wouldn't RECOMMEND_FAILED_INSUFFICIENT_STORAGE make more sense?), but this appears to be what's happening.

Possible Problems :

  1. No Internal/ External space in the Drive(or sdcard).
  2. Connection is lost during the installation (apk to device or emulator).

Solution :

  1. Try to create some space( remove some apps).
  2. Try to reconnect the phone/emulator restart (worked for me)

This can be caused by having insufficient space on the device. So it goes looking for an SD card to install on to instead. if that isn't there it will trigger this response.

I had this problem even with 1GB of free space and an .apk of 1,5Mb. What I did was building an .apk and moving it to data/app folder. This worked for me. The problem is that I think your device must be rooted in order to access this folder.

In my case, it helped me out to switch the usb connection mode. You have to "just load" the device by usb instead of providing the sd card to the pc file system.

INSTALL_FAILED_MEDIA_UNAVAILABLE

Because of low memory. Delete unnecessary files and apps.

This problem appeared for me when I installed Facabook app on my phone. so I uninstalled it and problem solved.

It is due to not enough space on the phone. Check your build packaging In my case it was packiging all kinds of assets, psd, etc.. and the .apk file was huge and the phone did not have that much space

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top