android – Installation failed with message Failed to commit install session-ThrowExceptions

Exception or error:

Getting an error message while trying to run an apk through android studio 3.4 canary 1.

Gradle plugin version com.android.tools.build:gradle:3.4.0-alpha01

Installation failed with message Failed to commit install session 526049657 with command cmd package install-commit 526049657.. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

I have tried uninstalling the apk, restarting android studio and the device and invalidating caches and rebuilding but nothing seems to work.

How to solve:

I disabled “Instant Run” in settings, and it works for me.(Android Studio 3.4 canary)

picture

Then you can see the adb command executed in the terminal is “adb push”, while it is “adb install-multiple” before that is disabled.

###

On Android studio go to build menu :
Build menu

Then:

  1. First Clean
  2. Rebuild
  3. run it again

*******It works well **********

###

  1. build->clean project

  2. rebuild project

  3. Delete as shown below

enter image description here

###

Disable “Instant Run”.

File->Setting->Build, Execution, Deployment->Instant Run-> unCheck (Enable Instant Run to hot swap code/resource changes on deploy)

and Run your Project and after that go and Enable Instant Run to use the advantages of Instant Run

###

If you have a version of the APK installed on a device/emulator and you create a new version of the APK that compiles against an SDK above the device/emulator sdk, you get this error vs. the original “yo, you are targeting 28 and this device has 26… come one, you need a 28 device/emulator”.

You have to actually turn off instant run to see the right error.

Why would you do this? Good question! I mixed up my Q vs P devices and wasted an hour trying to figure out what was going on. 😛

Leave a Reply

Your email address will not be published. Required fields are marked *