27

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.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Jude Fernandes
  • 7,437
  • 11
  • 53
  • 90

9 Answers9

30

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.

Milad Faridnia
  • 9,113
  • 13
  • 65
  • 78
ime
  • 401
  • 3
  • 5
  • This also solves others commit install session error like `pm install-commit` and `INSTALL_FAILED_INVALID_APK` error code. – stramin May 14 '19 at 12:58
  • Thanks man. You saved my life. I simply don't understand why even Google launched this feature if it is not stable. Leading to time wastage of Android devs. Phew. – Perry May 29 '19 at 06:45
  • This worked for me today with a clean install of 3.4. Thank you! – RichieHH Jun 04 '19 at 14:41
  • @Jude Fernandes This does seem to be a solution (worked for me). You should try it and possibly selected it as the solution to your question. – osprey Aug 01 '19 at 18:38
15

On Android studio go to build menu : Build menu

Then:

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

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

Abdulrahman Falyoun
  • 3,676
  • 3
  • 16
  • 43
Fitsum Alemu
  • 359
  • 3
  • 2
11
  1. build->clean project

  2. rebuild project

  3. Delete as shown below

enter image description here

initialise
  • 211
  • 1
  • 3
  • 11
3

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

Mohammad Davari
  • 430
  • 3
  • 13
1

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

codingjeremy
  • 5,215
  • 1
  • 36
  • 39
0

Most easy solution is, wipe data of your emulator and run project again.

0

I had fixed this problem by getting rid of the meta data section in my manifest. I have no clue how it was added to the manifest to begin with (I'm a noob), but once I removed it from the manifest, the app loaded right up.

<Activity

... />

remove the meta data line within the manifest and it should work.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 14 '21 at 07:27
0

This is what worked for me

Build > Clean Project

File > Invalidate Caches & Restart

abd3llatif
  • 170
  • 1
  • 6
0

Just checked In AndroidMainfest file is not complaining any issue. I have updated targetSDK version 33 and it required "android:export" flag in activity section

Amit kumar
  • 149
  • 14