Android Studio Stuck on "Installing APK" - android

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?

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.

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

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

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

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

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.

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

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.

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!

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.

Restarting Android studio worked for me

I tried rebooting my phone and it worked.

When attach my mobile to my PC, the follow menu is showed. I Clicke on it.
In the next section, I had changed from "USB connection" to "Transfer files"
After that adb install works for me.

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

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.

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.

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

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.

Check following in your project
build-gradle plugin version in project level build.gradle file
gradle version in gradle-wrapper.properties file
buildToolsVersion

uninstalling the previous installed app worked for me

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.

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

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

Related

Expo with Android Studio Emulator error: "Error running adb: This computer is not authorized to debug the device"

I am trying to connect an Android Studio Emulator to my expo application, but I get this error message:
Couldn't start project on Android: Error running adb: This computer is
not authorized to debug the device. Please follow the instructions
here to enable USB debugging:
https://developer.android.com/studio/run/device.html#developer-device-options.
If you are using Genymotion go to Settings -> ADB, select "Use custom
Android SDK tools", and point it at your Android SDK directory.
Does anyone know what to do with this?
Thanks!
What has worked for me just now:
Go to tools.
Select avd in Android studio.
Select your emulator.
Wipe data.
Click "Start again".
tldr:
Look at the emulator "screen" and accept the prompt asking if you want to allow debugging.
I got that message you described in the question when I did the following:
In Android Studio Virtual Device Manager (VDM), start the emulated device
run npm start (which runs expo start)
expo Metro Bundler runs (command line and browser)
in expo: select Android emulator
in expo: see the same error that you posted
The provided link didn't seem to pertain to the emulator.
I didn't realize at first, but the solution was waiting on the screen of the emulated device. It was quietly showing a standard Android permission prompt, asking for permission to allow debugging the device. This prompt is described in the "note" in https://developer.android.com/studio/command-line/adb#Enabling,
Note: When you connect a device running Android 4.2.2 or higher, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog.
This of course I would expect for a phone, but didn't think of it for an emulator.
Once I granted that permission in the emulated phone, then expo proceeded to run on the emulator.
I discovered that "USB Debugging" had been turned off in the Developer Options of the emulator. Turning it on fixed the problem. No idea how it came to be turned off.
I had this problem today, I just disabled USB debugging and enabled it again. Worked.
Go to android studio
Open AVD manager
Wipe data on your emulator (Clicking dropdown icon in actions column )
Launch emulator
enjoy :)
First close your opened android emulator.
Open android studio and go to AVD manager.
Select virtual device which you have faced trouble, under actions select wipe
data option.
Give ok for the opened window.
These steps worked for me.
I was using the emulator from Android Studio for my expo projects. It used to work properly.
Then, one day the emulator stopped interacting with expo, always saying:
This computer is not authorized for developing on .
https://expo.fyi/authorize-android-device
The advices given on that link did not help. Revoking the USB permissions did not help either. Even newly created Devices in AVD Manager did not let me connect.
However, finally this answer solved the problem for me
Choosing a device from AVD Manager without Google Play Store on it let me connect expo to the emulator, again.
Note: I could not get to the root cause of the problem, so I am still not sure why it stopped working all of a sudden. I upgraded to Expo SDK 39 at the same time that I switched from managed workflow to bare workflow. So, one of those circumstances may have caused the problem.
I know the exact answer of this question
The Problem is your AVD manager is not set to the path
Than you have add to path first is ANDROID_SDK_ROOT and PLATFORM-TOOLS
HERE I GIVE ALL THE LOCATION PLATFORM TOOLS - C:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools
ANDROID_DK_ROOT - C:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk
ADD in path (SEARCH ON START EVIRONMENT VARIABLES) and than restart your pc
Try running a lower version of the android emulator from android studio. I was getting the same error while trying to run the latest expo-react-native app on android emulator version 9.0 Pie. I got it working by running a lower version of the android emulator version 8.1 Oreo. You also have to tab allow/ok on the phone screen when asked for enable USB Debugging
during the app booting on the emulator.
I had the same issue and it almost took one day to figure that out.
First try enabling the USB debugging mode, still if it shows the same error try the next step. Try to check ADB devices in cmd, if it doesn't work go and change the environmental variables of the android SDK manager.
And refer this link
https://medium.com/#vsburnett/running-a-react-native-app-on-an-android-virtual-device-with-expo-in-windows-10-9e0976db5f50
For Windows:
Select 'Wipe Data' option in the AVD manager and restart again.
Or
Add SDK tools path eg: E:\Android\SDK and SDK platform-tools path eg: E:\Android\SDK\platform-tools in the windows system environmental variables. (In my case I have installed SDK inside the E directory)
Open the Android Virtual Device Manager(AVD Manager).
And in your current virtual device on the right side, there will be a dropdown icon, and click that icon.
In the dropdown list there will be a Wipe Data and click it.
And Run your Emulator
I was facing the same issue. I am using windows machine. Steps I did to resolve:
I have added the environment variable.
To Add System Variable, search environment variable in Windows (or search google how to open environment variables, if you are on some other system or cmd). In the system variable add the Variable: ANDROID_SDK_ROOT to your android studio path, like in my case it is: C:\Users\kushalseth\AppData\Local\Android\Sdk
At the same place, i.e. System Variable, Click on Path and add this, it already doesn't exists. Please check this path in your system: C:\Users\kushalseth\AppData\Local\Android\Sdk\platform-tools
To Validate, run the command: adb in command prompt.
(Also check, if you are logged-in to expo from cmd. This is an extra precautionary step.)
today I experience the same issue but I have fixed it very easily. Try the solution it might work for you too.
Many developers have wsl or windows subsystem for Linux and it is using a VM and I found it blocks the android sim and causes the error "Error running adb". The solution I found was to open my PowerShell and type "wsl --shutdown". After rerunning the script for android emulation from expo it worked like a charm. Hope I helped.
There are two ways of doing this.
Wipe SDK data
Kill a running emulator
First step:
Open android studio > virtual device > click on more_vert > select wipe data
Second step:
Open your command prompt and use this command
adb -e emu kill
or
If Expo CLI is running, stop it with ctrl+c -- this will stop ADB.
Disconnect your Android device from the computer.
Revoke USB Debugging on the device:
Open the Settings app on your device.
Navigate: Developer Options -> select Revoke USB debugging authorizations.
Reconnect the device:
The device will prompt you to agree to connect the computer. You must confirm it.
The computer is now authorized for debugging!
This computer is not authorized for developing on. https://expo.fyi/authorize-android-device
I resolved this issue by choosing a device without the google play store
(play button).
Enable Virtualization on your machine
Enter your BIOS settings on boot of your machin and enable Virtualization Technology. The location may differ depending on your processor.

Instant run issue on Android Studio 2.2

I have updated my android studio to 2.2, Since then I get this strange issue when running the studio gives me error Instant Run requires that the platform corresponding to your target device (Android 1.0) is installed. I am using Note 4 on android 6.0.1. Why is this error happening ?
If you have connected your android device, unplug it then uninstall the current app. Then plug the usb back and click run. You good to go.
Am also facing similar issues since i downloaded the upgrade patch for android studio 2.2
i have noticed it happens when Android monitor says device offline Android device says offline yet connectet
The reason why the device goes offline and yet its connected properly i don't know yet. When i click download i get this error Package id platforms;android-1
I currently sole this temporarily by checking if android monitor says device offline, if yes i unplug the USB and plug it back in else it just runs fine
I had the same problems as you all and I solved it.
If you get an error like 'error Package id platforms;android-1 ' you must go to: Tools -> Android->SDK Manager, and thed to SDK Platforms. Make sure that 'Show Package Details' tab is checked (so that you can see all packages) and Android 1.1 package installed.
Otherwise just install it like all others packages. After you do this, restart Android Studio, unplug/plug phone. You will be asked then to conform something at your device, say ok and you fixet problem.
I got the same problem, but with an emulator.
So the answer of unplug/plug the device is not applicable to me.
I deleted my emulator and create a new one in Android Studio.
And, it's solved...
Connect to your computer as MTP. After this Android Studio will recognize your device and SKD could install for it.l
I've solved this by changing the USB cable. The one given by Samsung is useless.
I had the same problem but it solved after I approve the confirmation box for connecting the phone to the computer.
Running the android studio as sudo did the trick for me.
i got same problem , i have unplug my Device then uninstall the current app. Then plug the usb back and click run. i am good to go and my Problem
In this Video there is a Solution for Error running app: Instant Run requires 'Tools | Enable ADB integration' to be enabled. It worked for me to disable the instance run error messages.
In my case SDK location was incorrect.
I disabled Instant_Run option.
please check SDK version in local.properties file.

Deploying to Android device not found in Visual Studio

I'm trying to deploy an Apache Cordova app to an android device that's plugged into the machine. However when attempting to deploy, I receive the following error:
Unable to deploy to Android device, no attached device was found. If you recently attached a device, you may need to wait a few seconds before it is recognized.
As far as I'm aware, I've enabled all of the developer settings I need in order to deploy to the device. I've tried unplugging and plugging it back in, waiting a few seconds but to no avail.
I've tried changing the connection modes (HTC Sync, Disk Drive ect) however that hasn't made a difference.
The android device I'm trying to deploy to is pretty old (v3.35.61.3), so I've even tried to deploying to a different android device running the latest version of android however the same issue occurs.
This leads me to believe that it's an issue with Visual Studio not picking up any connected android devices. Perhaps I'm missing an install package?
After smashing my head against a wall for a couple of hours, I managed to get this fixed.
I followed these instructions to install the SDKs for the target device.
There was still an issue where the abd devices command was still not showing up with any devices, I installed the Universal ABD driver which I found in this question and that worked for me.
EDIT
Some of you have found that the following can also fix the issue:
Turn on the Developer Options on the device.
Enable USB Debugging.
It might be worth trying this first, and if that doesn't work, try what I did.
I ran in to this problem and I was sure I had everything installed. After some thought I tried to deploy again, and in the developer options on the device I turned usb debugging off and then back on, this got me a prompt to remember my computer's fingerprint. After that everything worked.
I had this issue too (can't reply to the answer because my rep is too low) and I found out that when my phone updates, it turns USB Debugging off. It's worth the time to check.
I had the same issue on my S4. When I turned on the developer options the Enable USB Debugging was turned off. Once I turned that back on the issue was fixed.
First option : Enable USB DEBUGGING
Second option : Change your phone cable.

App hang on install in Android Studio

Usually I build an app in Android Studio to test an app on Phone. But this occurs when I just click the Run app
Waiting for device.
Target device: motorola-nexus_6-ZX1G227B86
Uploading file
local path: F:\HeadFirstAndroid\MateClient\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.diyu.org.mateclient
Installing com.diyu.org.mateclient
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.diyu.org.mateclient"
It seems that the process is stuck on the pm install and no app is installed on my phone. What's the issue?
And other projects acts the same, hang on the install.
I fixed this issue by going to Settings on the device -> Developer Options ->
uncheck "Allow USB debugging' -> Recheck box. And next time, the software started correctly.
I was stuck on install. Restarted the phone, and it worked.
In my case the device was the problem. It refused any install or uninstall commands. You can easily test this via the adb command adb install [your apk file]
If the command line is stuck too, than this means that it is not "studios fault".
Also an uninstall returned Failure [DELETE_FAILED_INTERNAL_ERROR].
There must be something wrong with the installation-state inside of android.
I was able to solve this issue by manually installing my app via an apk file
that I dropped into my sd card. Then I used adb uninstall [my_package]
which resulted in Success.
Finally I could install my application from Studio as normal.
In my case, just run (Mac: ^R, Windows: Shift + F10) again solved the problem.
I fix this issue by unplugging the phone and re plugging it. If the problem persists, there may be something wrong with your drivers/USB cable or the ADB service.
In my case to solve the install hanging, I performed the following:
ran flutter clean
turned off wireless debugging on my phone
connected the phone via USB
ran the app
The app installed correctly, after which I stopped the app.
re connected wirelessly then it installed and ran correctly
i think the problem is in the size of your Dex, uninstall your app from your devise first then try cleaning your project,and run your project without pictures
I fixed this issue by updating the OS to the latest Android version
I fixed this issue by closing the project and reopening it. But I know this is not the only solution/may not always work.
File > Close project and then reopen the project.
Might be a bit late.
The only thing that solved this for me was device reboot. Once I restarted the problem was on LG G4c and once I restarted it everything went back to normal.
If by any chance you are using Xiaomi phones such as Redmi or whatever, you should try to toggle the "Install via USB" option.
For me, when I disabled and again tried to enable it, it gave me the error "The device is temporarily restricted". This was preventing me from installing apps and is the reason android studio was stuck at "installing apk".
So fix this, use a VPN to connect so any chinese server, preferably shanghai, and then try to enable the "Install via USB" option. Other users reported that turning of WiFi and using mobile data to enable the option also works.
Check if your device has multiple user accounts. cause when android studio tries to install app on pyhsical device it installs it on all accounts.
and if you uninstalled your app from your account but not from others, android studio will try to update existing app, which you don't have.
So, uninstall app from all accounts and then try to install.
On Redmi phones. If you do have a second space in your phone, the android studio probably installed the app in that space.
Delete the app from the second space then try again. Worked for me.

Android Studio doesn't recognize my device

Here is the problem. I want to run my Android Studio apps on my device (Samsung Galaxy Ace 2). But nothing works for me. Tell me what I've missed:
1) USB debugging is on
2) ADB driver is installed (in device manager i can see Android Composite ADB Interface)
3) ADB device list is still clear, even if i reset server(adb kill-server, adb start-server, adb devices - list of devices is clear)
4) in google usb driver directory, in android_winusb.inf file I added my device identificators
5) Android device manager still cannot connect to my device, showing this error when I reset it: "adb connection error an existing connection was forcibly closed by the remote host"
So I will be glad to hear any advices. Hope you'll help me
Did you try to configure the "Media Mode" in "Camera (PTP)" instead of "Media device (MTP)"? This is sometimes solving the issue. Its in the USB Computer Connection options of your Android device, you should see an "authorize" dialog then.
Update 04/2017: looks like it has been fixed in Android 7.1.2
I have done numerous ways of handling that issue. Finally it has worked! I am using LG Optimus II, but I believe the following steps are generic to other Android devices as well.
Step 1:
Make sure your device is enabled for development. If yes, go to Step 2, otherwise go to Settings > About phone and tap Build number seven times which is magic number :-).
Now Developer Options is available in the Settings.
Step 2:
Before you plug your device to PC, Go to Settings > Developer Options and select USB Connection method.
Step 3:
Plug the phone to the PC, you are given options for the USB Connection method, and please select Internet connection. Make sure you have connected to the Internet. By the way, I have changed MTP to PTP, it did not work for me. Therefore, I tried Internet connection mode, then it worked.
Step 4:
Run the app in the Android Studio, it will ask you to authorize the device for development, and select YES!.
Step 5:
Run the application via Android Studio and choose the device, not emulator, and BINGO! Welcome to Android development board.
Try swapping the USB port the cable is plugged into.
Sounds crazy but after 20 minutes of debugging this worked for me.
I also tried above solutions but got no luck. So here's what I did:
Download and install PdaNet+ to fix connection issues between my computer and android device
Enable USB debugging on my android device
Unplug the phone and plug it again after it's installed
Run my app and voila! My android device is now recognized by Android Studio
Although my computer could recognise my phone, I had to install the official drivers from the Samsung developer site to get adb/Android Studio to recognise it:
Samsung Android USB Driver for Windows
Click Revoke USB debugging authorization in Developer option and try it again.
Solution for those working with Huawei phones - You will get this error when ADB interface is not installed. Check if you have installed Huawei HiSuite. USB driver gets installed when you install HiSuite (I suppose this is true for most of the new phones that come with a Sync Software). If the ADB interface is installed on your computer you should see 'Android Composite ADB Interface' under Android Phone in your Device Manager as shown in this picture.
If you have Mi Device than you need to enable this two option after enabling Developer Mode.
USB Debugging (Enable = True)
Install via USB (Enable = True)
See this screenshot.
LG Optimus Zone 2 pp415 d\n connect in mtp, but does work in internet connection mode. Lost lots of time messing with it. There's no doc for this, but I'd suggest trying all 4 of the connection options. Only 1 that works for me is Internet Connection->Ethernet, then win 8 auto-detects a driver and installs it. In MTP mode despite all drivers being registered with device manager, adb doesn't pick it up.
I had the same problem. So here is what i did
reinstalled the device driver
changed the USB computer connection from MTP to Mass storage(UMS)
And it worked.
For me, I tried the above. Turns out my USB cable was bad. I changed the cable and then it worked.
I am sorry that i bothered you all. The problem was my device is cloned in different places in device manager. It was gone when I tried to update driver for my phone in "Other devices" list, and before i have been updating it in wrong sections. Thank you all.
In my case it was due to already running and hanged adb.exe on another user under my PC. I had two users on my PC, the second user had the adb.exe process hanged even when I tried to end the process. It worked with me after (End Process Tree) from the Task Manager.
Hope this will help someone with multiple users :)
Ahmad
In addition to the above configurations, I had to set deployment target to "Open Select Deployment Target Dialog", run once (choosing my device from the options listed), and from then on Android Studio was able to see my device even after changing the deployment setting back to "USB Device". My SWAG is that since Android Studio uses its own internal cache to find your device, it has to be initialized first.
I was on Samsung S8 and had same problem too. After I installed Samsung Kies, issues was resolved for me, as I believe it had updated the correct driver required for my Samsung S8.
On Windows 7 , the only thing that worked for me is this. Go to Device Manager -> Under Android Phone -> Right Click and select 'enable'
i had to install android studio in 2 machines and ive solved this problem intalling samnsung kies, i use 3 diferents samnsung devices (plus some other of my family and friends) and i dont have to strugle with the drivers, it works for me and i recomend it. hope it helps
For me, this ended up being because I had the wrong SDK level installed (new version of Android Studio installed the SDK for Android 10, whereas I have a device that runs only Android 8.1). While Android Studio would "recognize" the device and display a string in the "devices" menu instead of just saying that no device was connected, installing the right SDK level for my device ended up changing the string to something recognizable (my device's model name) and allowed me to actually run my app over ADB.
I had a big problem with my Samsung S10 Plus as it was not detecded by Android Studio on my Macbook even if I did all what is required to be detected, that is to say:
Enable developer mode (7 taps on Build version in Android settings)
Enable USB debugging
What I did is to start "Android File Transfer" on my Macbook and the magic happened. A popup appeared on my device asking if I want to authorize an USB access to it. I clicked "Yes, always" and now Android Studio can detect my device on my Mac :)
Change the connection method Build-In CD ROM it works for me
On HTC mini one 2, besides enabling the Developer Options, the following worked for me:
Go to More in Wireless & Networks
Mobile Network Sharing
In USB network setting
Select Internet pass-through

Categories

Resources