Failure INSTALL_FAILED_MEDIA_UNAVAILABLE

后端 未结 9 1836
生来不讨喜
生来不讨喜 2021-02-12 19:22

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 go

相关标签:
9条回答
  • 2021-02-12 19:53

    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.

    0 讨论(0)
  • 2021-02-12 19:59

    INSTALL_FAILED_MEDIA_UNAVAILABLE

    Because of low memory. Delete unnecessary files and apps.

    0 讨论(0)
  • 2021-02-12 20:04

    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.

    0 讨论(0)
  • 2021-02-12 20:06

    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.

    0 讨论(0)
  • 2021-02-12 20:06

    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

    0 讨论(0)
  • 2021-02-12 20:07

    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.

    0 讨论(0)
提交回复
热议问题