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.
Related
I have a clean Android project on Android Studio (just with a "hello world' screen), and I'm trying to install the app on my Samsung Galaxy S10e.
I click the Run button, and this is what I see in the Build Output:
And the apk is generated successfully.
But it's not launched and not installed on the device (no icon, and it doesn't appear in the apps list).
When I try manually installing the apk by adb install app-debug.apk, it works. The app shortcut appears on the device, it's added to the apps list, and I can launch the app.
At first also adb install didn't work, giving out the error INSTALL_FAILED_TEST_ONLY, but I solved that by adding android.injected.testOnly=false to gradle.properties.
I tried changing Gradle version to 6.0.1 (looks like this is the latest at the moment), and it didn't help.
I also have my device selected at the top:
How can I make Android Studio install and launch the app on my device?
Android Studio version: 3.5.3
Edit:
I'm seeing the same behavior on an Emulator. I opened AVD from Android Studio and chose Pixel 3A. The emulator opens up, I run the app, nothing happens on the emulator (and I see the same Build Output messages).
The same happens to me. It is probably a bug in Android Studio. At the second compilation the app installs correctly. It is tedious.
There isn't enough information to find the cause of this issue.
But since it works with adb, it means you run adb command. There could be only one instance of adb daemon running. So if it's involved externally my guess is Android Studio won't have access to it.
Possibly try adb kill-server and running again from Android Studio and see if that helps.
I encountered the same problem, which I solved by checking the running devices. The connected phone had 2 accounts (might be personal & work) which was listed on the list of devices, so I had to select the second option, and it ran successfully on my phone. see the attached image.
One thing it might be:
Enable usb debugging
Settings
System
Developer options
Turn the setting on for usb debugging
If it does not appear go to settings about phone. Then click on build number like 7-10 times and it will enable you to have the developer options appear.
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.
When I launch my virtual device ,it launches but my app doesn't show in AVD.
I update all the plugins and platforms required..after some time android studio given this error as following : Error while installing apk.
Please, solve my problem why this is happening, I'm suffering from 2 days.:(
Make sure your emulator up and running.
Also you can try running it on to your phone the process is simple,
Go to android setting=>About=>Click on build varian 7 times to become developer.
2.go to developer section and enable the debugging mode.
3.now if you are on window pc you have to download google usb driver and for MAC you can directly connect and you are good to go.
Make sure that you should uninstall all the applications that were developed by you in the emulator. After uninstalling all the applications that were build by you in the emulator, then clean project, run it again.Let me know if this works out.
Have you tried increasing the adb connection time out on the AVD?
To test this, first launch the avd and make sure it is turned on and running. Then try to build your application and install the .apk onto the device.
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.
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.