Unable to install android app via usb debugging - android

I know this is an old question but I am trying to install my app the very first time on Redmi note 4.
Whenever i try to install it displays a dialog saying..
Installation failed with message Failed to establish session.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
And it gives error after this.
This app is not installed before,I have cleared cache,rebuild the project,restarted my phone but nothing is working.

How to disabling Miui Optimizations
This issue was happening on my phone which is Xiaomi Phones running on Miui 8. After turning off Miui Optimizations on Developer Settings, restarting the phone a recompiling the application it worked.
for more detail: android gradle:2.3.0 install apk fail

Open
1.File
2.Settings
3.Build,Execution,Deployment
4.Instant Run
5.Un-check (Enable Instant Run to hot swap code)
Its work for me..

I'm Using Redmi Note 4 mobile (Xiaomi Phone). I got the same problem.
Problem Resolved:
Go to setting >> Additional settings >> Developer options >>Turning off MIUI Optimizations
and also turn on USB debugging and install via USB.
And then restart your phone. After that, I am sure that your problem will be solved.

I didn't have to turn off MIUI optimizations (using MIUI v8.5.3.0 MAGCNED). In my case I was blocked by the MIUI security system.
Go to Settings > Additional settings > Developer Options
Turn ON USB Debugging
Turn ON install via USB
Turn OFF Verify apps over USB.
Once you do this MIUI will prompt you whether you want to install your app. You only need to accept permission once.
One strange issue I notice is that I cannot enable install via USB without sim card. However, Once it is enabled I am able to remove the sim.

This issue was happening on my phone which is Xiaomi Phones running on Miui 8. After turning off Miui Optimizations on Developer Settings, restarting the phone a recompiling the application it worked.
have so much pain looking for this way. just scroll down to bottom and you will find it.

The latest version of Android OS will have multiple user logins like admin and guest, whenever we install an app through USB debugging, that .apk file will be installed for all users in the mobile, Uninstall the .apk file from all the users including guest login.

Turn off Developer Option
Restart your mobile
Turn on Developer Option
Turn on Usb debugging
Worked for me. Hope it works for others...

This issue occurs sometime I have also faced the same issue.
Try the following steps
Go to Settings > Additional settings > Developer Options
Off your Developer Option and re-On it
On - USB debugging
and press Revoke USB debugging authorization
I hope it will work.

In my case Faced the Same Issue with My Redmi 3s PRIME and I can't able to enable the Install Via USB and it asks to connect Network So I tried the Following Method and luckily it works...!!
Open Inbuilt Securit App.
Click On Optimize. (While Scanning, It Disables the Developer Option )
Now Open Settings->About Phone-> Tap On MIUI Version to Enable the Developer Option
Open Additional Settings -> Developer Options.
Now Re-enable the USB Debugging it automatically enables the Install Via USB
In Android Studio Disable Instant Run Settings>Build, Execution, Deployment>Instant Run
Now Run the App with Android Studio.

I had a similar issue. Manifest file had an option:
<meta-data
android:name="com.google.android.actions" />
which was causing the issue. I removed it and everything started working fine.

you can also check the build gradle, the minSDKVersion should match with your physical device

Related

INSTALL_FAILED_USER_RESTRICTED Installation via USB is disabled

09/18 11:00:20: Launching 'app' on Xiaomi Redmi 6.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_USER_RESTRICTED
Installation via USB is disabled.
Try turning off MIUI optimization (see https://stackoverflow.com/a/48524656/80901). This helped me with a Redmi.
If anyone trying in MI Phones and no other option for him his there, As Turning off MIUI optimization decrease the battery performance. Then he can try cleaning data of Security app.
Note- This can once ask your pattern lock after doing it. After that it will work fine.
Please Turn on "USB debugging" in developer options. Additionally you also have to turn on "Install Apps via USB".. Hopefully it will work smoothly.
Turn on USB debugging in Developer option and when you connect your device to PC via USB a popup will appear, please check allow "USB Debugging" Option, and your app will be installed without error.
I have Xiaomi Redmi 4, so hope it is relevant to Redmi 6.
When trying to install via USB, the device will ask you to enter via your MI account and if you not have one so create it and then Installation via USB should work.
Go to the Developer option and turn on "Install via USB" option which is below of "USB debugging" option.
Run "adb uninstall " and it solves the problem.
It occurs when you uninstall manuelly an app which is build by Android Studio.
If you changed Background process limit in Developer Options to No background process. The same error will also occur.
If you did, change Background process limit back to Standard limit
For those who working with knox container try:
AndroidStudio -> Run -> Edit Configurations -> [select] : Install for all users.

Android Studio Stuck on "Installing APK"

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.

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.

How to debug my android aplication with my phone Allview P5

I open the list with http://developer.android.com/tools/device.html, however I don't see Allview in the list. How can I debug an android application with eclipse - Allview P5?
You must install an adb driver, and since Allview does not have one ( I experienced the same problem ) you have to use an universal one:
https://plus.google.com/u/0/103583939320326217147/posts/BQ5iYJEaaEH
This worked perfectly for me (I own a P6 Stony).
USB Debugging should be enabled. You may find that option in Settings>Developer options in some phones and in Settings> Applications in some others phones(basically the option will be present in settings somewhere if its available on the phone so please check thoroughly). Secondly not all phones have this functionality so check first whether it has. Also check if your devices device drivers are installed properly. if not reinstall them. finally do Check whether your Android SDK is up to date. if not, then update it.
If USB Debugging option is not available. You can still install your app on such phones with the help of ADB which stands for Android Debug Bridge. for this connect your phone via the USB cable provided. Once the device is recognised. Open your command prompt and type
adb devices
if you see your phone listed there then type
adb install your_location/your_file.apk
But in this case you wont be able to know where your app is crashing. You can just test if it works or not.
All device vendors may not provide debugging functionality...
if it is provided then Did you put your device into debug mode? This should be found under Settings-> Applications->Development.
and even Install the USB Driver using Android SDK Manager:

why eclipse can not detect android device?

Eclipse can't detect my android device but it can run with the emulator. i have no problem with the android device setting since it work well in my old laptop.
any idea?
When you start the Device sometimes adb doesn't recognize it because it has already started. So, in that case you just need to reset adb from DDMS->Devices
Go to android-sdk/platform-tools/ via command promt...
write command.. adb devices (It will show the list of attached devices)
If its not display device number then look at the drivers of device on your system. And if display then just restart eclipse..
Check that the android:minSdkVersion is lower or equal to the Version running on the phone. If it is higher it wont show on "Android Device Chooser"
Also, after installing the usb drivers you may need to set your Android device to developer mode and enable USB debugging on your device before it will be seen by adb or eclipse. From http://developer.android.com/tools/device.html
2.Enable USB debugging on your device. ◦On most devices running Android 3.2 or older, you can find the option under Settings > Applications > Development.
On Android 4.0 and newer, it's in Settings > Developer options.
Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
In my case, i ran adb-devices and it did show my device and it was unauthorized on the PC I was using.
I went to developer tools and disabled and then enabled USB debugging. It then prompted me for authorization for that computer, and then it worked fine.
Hope this helps someone.
Try connecting using the command prompt ./adb connect 192.168.xxx.xxx:5555
If you are running Linux you will have to add your device to the /etc/udev/rules.d/51-android.rules file.
Have a look here: http://developer.android.com/tools/device.html . Its a document on using hardware devices.
haven't you enable 'debug mode' in your Android device?
If not, then please enable it first. Then follow the steps in this article.
This example use Lenovo P770 as a device.
http://www.mywordismyopinion.com/2014/02/experience-using-smartphone-lenovo-p770.html
-hope this is helpful, :).
just install any driver are any compatibility software provided by your device provider like Samsung provide kies,Htc provide Sync etc..
Either check check your sysytem or antivirus not block it.

Categories

Resources