I was getting the message
> Installation failed with message Failed to establish session.
so following some responses to the problem I
If you are using phone this error comes due to less storage. Make some space and try again it should work.
I uninstalled all the apps I ran and got installed on the virtual device and the error went away.
In Android Studio, open the AVD Manager and edit the problematic emulator. Inside the edit screen, you might need to click on 'Show Advanced Settings'. Scroll down and increase internal memory and SD card memory. After I did this I could install my app again.
The problem is with your storage space on your device which it is running. Try Installing Clearing the space or install it on an emulator.
Put this line inside app/build.gradle
:
defaultConfig {
...
android:installLocation="auto"
....
}
that file-system has no space:
java.io.IOException: Requested internal only, but not enough space.
the issue is:
android:installLocation="internalOnly"
either remove it, or replace it with:
android:installLocation="preferExternal"
or make some space on the device / emulator by uninstalled or deleting something -
or simply assign some more megabytes to the virtual SD card.