Installation error: INSTALL_FAILED_MEDIA_UNAVAILAB

2019-01-18 18:08发布

问题:

When I run an android app from eclipse I meet this error and my app does not start:

Installation error: INSTALL_FAILED_MEDIA_UNAVAILABLE

Please check

logcat output for more details. Launch canceled!

But when I opened logcat, I see that logcat doesn't print anything.

I think that some problem with my manifest file. so here is my manifest file:

android:installLocation="preferExternal">>

<uses-sdk android:minSdkVersion="8" />

<application

    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:debuggable="true" >

    <activity
        android:name=".HelloWorld"
        android:label="Test" >

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>


    </activity>
</application>

<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8"/>    
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

回答1:

Is your Phone connected via USB? if yes, the SDCard is not mounted. Try to connect your phone in another mode or copy your software apk onto the SDCard, disconnect it from the pc and run the installation. It should work then :-)

For example, my Motorola Defy supports the usb modes "mass storage mode" and "media server" mode. In mass storage mode, the sdcard is unmounted from the device, so you can access it from your pc.

The problem is the "preferExternal" command, which tells Eclipse to try the installation on SDCard. You can also try to erase the installLocation command to install it your app in internal storage.

Greetings!



回答2:

It's can be because of low memory. For me problem solved when delete some unnecessary files and apps.



回答3:

  1. Go to cmd
  2. cd to android sdk folder > platform tools
  3. Enter adb shell, now a # sign appears
  4. Enter pm set-install-location 1 and another # appears should work fine with you.

Note: The 1 in the pm command signifies that apps will install only on the internal storage. See pm command for more info.



回答4:

In my case the solution was to restart the phone.



回答5:

i solved it by adding the following line to the AndroidManifest.xml file in your app:

android:installLocation="auto"

...it should be like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.MyTestApp"
android:installLocation="auto"


回答6:

In my case

1 - uninstall some Useless/low use apps

2 - clear ram memory



回答7:

My case worked after I deleted some files or apps on the phone. I use an Htc phone I think the phone needs some amount of space to be available on the internal memory, and the amount of space needed varies from phone to phone



回答8:

If none of the fixes above worked for you, like it didn't for me, there's a really simple fix you could consider.

In your USB computer connection settings, uncheck the "Mount SD card" box and leave it only checked at "Media device (MTP)". Then run the app again.

This way your external storage won't be unmounted when you connect your device to your pc and your app will then install successfully



回答9:

this worked for my device: I had tried installing the apk through various means (adb install, installing it using the installer app, as well as the advice here) only to find that the solution was related to an app called Twilight, which once uninstalled, I was able to install apks again. I found the solution here. If anyone can shed light on how an app can block installs like this did, that would be much appreciated.



回答10:

Insert memory card in your phone if not work then root your phone it will definitely work.