Installation failed with message Failed to commit install session

那年仲夏 提交于 2020-12-04 15:40:22

问题


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.


回答1:


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

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




回答2:


On Android studio go to build menu : Build menu

Then:

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

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




回答3:


  1. build->clean project

  2. rebuild project

  3. Delete as shown below




回答4:


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




回答5:


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. :P



来源:https://stackoverflow.com/questions/52942779/installation-failed-with-message-failed-to-commit-install-session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!