59

Android Studio no longer seems to be detecting when an app has installed on a target device and opened. It gets stuck on "Installing APK" and the progress bar is empty. There are no errors, the apk successfully installs and opens, it's just the IDE is still showing "Installing APK" and it does not automatically connect the debugger. I can manually connect the debugger using the "Attach debugger to Android process button", but this is not ideal.

Can anyone offer any suggestions for what's up and how to resolve it?

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
peterfhannon
  • 1,083
  • 1
  • 8
  • 11

25 Answers25

36

It turns out the problem wasn't with Android Studio, but with the device I was using for testing. I tried a different device and it behaved normally, progressing beyond "Installing APK" and stopping on breakpoints.

Somehow the "wait for debugger" setting in developer options on the problem device had switched to off. I switched this back on and now this device is behaving normally.

-Note that I had to choose an arbitrary debug app for the setting to become active. Once I'd set it on, I deselected the debug app and the setting remained on, as I left it. This was a HUAWEI P8 running android 6.0 API Level 23.

peterfhannon
  • 1,083
  • 1
  • 8
  • 11
  • 1
    Same was the case with me. The phone wasn't attaching properly to my mac due to data cable's fault. – Ajji Jul 23 '18 at 10:29
  • 1
    Amazing. I'd add for clarification : 1) Go to developer options 2) Select debug app 3) Turn on "wait for debugger" 4) Run your app again – Sebastien FERRAND Oct 09 '18 at 02:56
  • Funnily enough it worked a couple of time and then back to taking forever (even though the setting is still on). Sigh. Edit : Davor answer solved it for good. – Sebastien FERRAND Oct 09 '18 at 03:25
  • In my case, after pie update, it's stuck on installing APK. And it doesn't install also. But after restarting the phone it worked fine. Thank you. – Gunaseelan Jan 02 '19 at 08:21
  • You saved my life! Thank you! – fateflame Aug 07 '20 at 02:25
31

Recently, I was facing the same issue when I have updated My Device (MI A1) OS from Android Oreo(8.0) to Android Pie(9.0),

Solution: Go to the Settings > Developer options > Now click on > Revoke USB debugging authorisations.

It will disable/remove developer options from your device, Now restart your device once and then you just need to re-enable your developer options and that all you need to do, Enjoy Developing on Pie.

Hope this will help you as well.. :)

Uttam Panchasara
  • 5,735
  • 5
  • 25
  • 41
25

I found a solution that works for me. In Developer Options turn off "Monitor apps installed by ADB".

screenshot

François Andrieux
  • 28,148
  • 6
  • 56
  • 87
Davor
  • 676
  • 1
  • 11
  • 15
13

Just reboot your phone (: It happens after update android version.

gordinmitya
  • 967
  • 10
  • 10
  • 2
    Apparently it was exactly that. A new android version was updated. Rebooting solved the issue after burning a full hour on that. Thanks a lot! – lior_13 Jan 24 '19 at 07:51
10

On my HTC One I unchecked “Verify apps over USB” in Settings -> Developer Options.

Steffo Dimfelt
  • 870
  • 12
  • 11
  • That saved lot of my time, just worked for me on Samsung A51 – code2be Feb 13 '21 at 16:35
  • For me on Pelton bike, this is grayed out and I can't change it. https://www.reddit.com/r/pelotoncycle/comments/nzd3b7/pelton_adb_install_packagemanager_keys_mismatch/ – PAS Jun 14 '21 at 12:53
5

I had this same problem. I solved it by revoking USB Debugging Authorizations and then re-enabling USB Debugging on my chosen device(s).

Edit: Cleaning my project also helped with solving this problem.

LukeWaggoner
  • 8,869
  • 1
  • 29
  • 28
  • Thanks. Turning off and on solved my issue as well (I revoked access by mistake and checked the "remember choice" option). – JCarlosR Jul 12 '19 at 05:36
3

for me it was something magic I solve it by removing the USB from the Laptop and from mobile too(type-c cable) and

turning off the debugging mode and again turn it on

and then I connect it back to my Laptop and selected the same FILE TRANSFER MODE then run the app and it get installed to my device and work as expected Hope you will find Useful to

Mickey Mouse
  • 55
  • 2
  • 4
3

I have this problem recently on my Pixel 2 testing device, latest factory image with Android Studio 3.4, on windows 10.

I have tried all methods mentioned but none of them work. It cost me more than 6 hours to figure it out.

My problem is the USB driver, I am not using the "perfect" USB driver. My driver works in most scenarios and commands but not in every scenario.

You do not need Android Studio to dig into this problem, just using adb.

Please try if you can install apk from adb using following command:

adb install xxxx.apk

If it stuck at "performing streamed install" but never finish, this is the problem.

Please try push a big file(more than 5MB) to your device:

adb push xxxx.apk /storage/emulated/0

In my testing, it stuck at 13%, 16%, etc, but never go on. It seems cannot transfer large files. This is why the installation is pending in my case.

I update the driver to another one, and the problem is fixed. Hope it can solve your problem, too.

Hexise
  • 1,520
  • 15
  • 20
  • can you be more specific as to the "i update the driver to another one, and the problem is fixed." which driver are you speaking of? – esaruoho Dec 05 '19 at 15:00
  • @esaruoho the driver depends on your device. – Hexise Dec 06 '19 at 15:22
  • hmm. all i ended up doing was enable the usb-debug mode on the phone, when plugging the android device onto my mac laptop, and then run the `adb install file.apk` command and it worked. still no idea what driver you might be talkin about – esaruoho Dec 10 '19 at 05:50
  • @Hexise Could you please elaborate what driver you're talking about? I'm having this same issue on an Android TV. – Drunken Daddy Jan 04 '23 at 11:10
3

In my case it was USB configuration settings.

Choose File Transfer option in Developer options -> Default USB configuration

multi cat
  • 31
  • 2
2

I had the exact same problem.

what's more, i can not adb shell and adb push files.

I am running an Ubuntu 18.04 VM and test on xiaomi phone 8,9. The problem for me was the USB Compatibility setting for the VM was set to 2.0, it needs to be at least 3.0. To change the setting power down the VM and choose the "Edit virtual machine settings" in the VMPlayer startup menu. Then select the "USB Controller" device and change "USB Compatibility" to USB 3.0. Hope this can help u!

Cyrus
  • 8,995
  • 9
  • 31
  • 58
2

When attach my mobile to my PC, the follow menu is showed. I Clicke on it. enter image description here

In the next section, I had changed from "USB connection" to "Transfer files"

FRom cable mode to Transfer mode

After that adb install works for me.

Egalicia
  • 683
  • 9
  • 17
1

It doesn't hurt to verify your USB port. In my case it was the faulty USB port which I had to switch to the mobo's one instead of the case port.

Vijay Kumar Kanta
  • 1,111
  • 1
  • 15
  • 25
1

Restarting Android studio worked for me

Zoe
  • 27,060
  • 21
  • 118
  • 148
Richard Lindhout
  • 2,038
  • 2
  • 23
  • 38
1

I tried rebooting my phone and it worked.

amyst
  • 616
  • 1
  • 10
  • 22
1

Just reboot your mobile . If not working try reboot your Android studio and mobile.

Tarif Chakder
  • 1,708
  • 1
  • 11
  • 10
0

In my case, Second Space was created but not switched on. I had to delete the second space and everything worked just fine.

My settings are:

  • Usb debugging -> ON
  • Install via Usb -> ON
  • Verify over USB -> ON
  • Wait for debugger -> ON

Device: Redmi Note 5 Pro

Pushan Gupta
  • 3,697
  • 5
  • 23
  • 39
0

I had this issue with an emulator on Linux. After trying pretty much every solution and suggestion on this page, what made it work for me was turning off Instant Run.

0

In my case i did not make sure that my android studio DSK manager was up to date with the android version that my device was operating on. So when running flutter doctor all seemed well, and i had the latest android version and all on android studio, but as mentioned it was not matching the version for my device i had connected.

Once i added the correct android version (in my case android 6.0) with SDK manager using android studio, it did not get stuck at installing apk.

0

My case was similar but for Android Version 10 required having the Verify bytecode of debuggable apps to off.

Final settings were:

  • USB debugging -> ON
  • Wait for debugger -> ON
  • Verify apps over USB -> ON
  • Verify bytecode of debuggable apps -> OFF

Device: Pixel XL

0

For me, the top answer "wait for debugger" was completely greyed out.

What worked for me was to look inside "Apps" and I noticed the app was uninstalled, but only for my current user. Clicking uninstall for all users unblocked the installation via Android Studio again.

giorgio79
  • 3,787
  • 9
  • 53
  • 85
0

Check following in your project

  • build-gradle plugin version in project level build.gradle file
  • gradle version in gradle-wrapper.properties file
  • buildToolsVersion
JaydeepW
  • 3,237
  • 1
  • 25
  • 27
0

uninstalling the previous installed app worked for me

Mohammad Sommakia
  • 1,773
  • 3
  • 15
  • 48
0

Turn off Verify apps over USB and Verify bytecode for debuggable apps (might not be available for all devices) in your Developer settings menu. The install time will decrease drastically.

Devansh Maurya
  • 832
  • 12
  • 11
0

I'm using Visual Studio Xamarin and the issue was caused by the missing CPU architecture. After checking them, the APK became installable via adb install ...

enter image description here

CelinHC
  • 1,857
  • 2
  • 27
  • 36
0

For me none of the answers worked, but giorgio79's gave me a hint. What worked for me was removing the second space, where I guess the app stayed even when I removed it from my main profile and prevented it from installing again.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 20 '23 at 04:44