I'm using Android Studio to connect to run app in my Xiaomi Redmi Note 3G device. My device is already found in the Choose Device Dialog, but I keep getting the [INSTALL_CANCELED_BY_USER] error :
Waiting for device.
Target device: xiaomi-hm_note_1w-SSE6Y97PFYQCRK45
Uploading file
local path: C:\Users\Anthony\AndroidStudioProjects\UASProject\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.si.UASPROJECT
Installing com.si.UASPROJECT
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.si.UASPROJECT"
pkg: /data/local/tmp/com.si.UASPROJECT
Failure [INSTALL_CANCELED_BY_USER]
I tried looking for solutions online, but there's no mention of Failure [INSTALL_CANCELED_BY_USER] error.
Happens to my Xiaomi phone after updated it to MIUI 8. Took me hours to figure it out!
Check the followings if you're a victim too:
Go to Settings -> Permissions -> Install via USB: Uncheck your App if it's listed.
Go to Settings -> Additional Settings -> Privacy: Check the Unknown Sources option.
Finally go to Settings -> Additional Settings -> Developer options: Check the Install via USB option.
Update (MIUI 8):
Signin in to MI account is required to enable Install via USB option.
Update 2
For some devices (e.g. Redmi) you might need to turn off MIUI Optimization and reboot your phone.
Settings > Additional Settings > Developer Options > MIUI Optimization
P.S. don't update MIUI unless necessary!
May the victims saved
I have same problem before, here is my solution:
Step 1: Go to "Setting" → find "Developer options" in System, and click.
Step 2: TURN ON "Verify apps over USB" in Debbuging section.
Step 3: Try "Run app" in Android Studio again!
Turn off Miui Optimizations on Developer Settings, then Restart the phone.
Step 1 : Turn on Developer Option (Settings > About Phone > Click 7 Times On "MIUI Version").
Step 2 : Connect Your Device via USB to PC
step 3 : Settings > Additional Settings > Developer Options > Turn On USB Debugging.
Step 4 : Also You Should turn On Settings > Additional Settings > Developer Options > install Via USB
Enjoy Coding ... :-)
In my case I turn on "Install via USB" and also make sure "USB Debugging" is on.
if you are at MIUI 8.
Follow the steps
Step 1: Settings > Additional Settings > Privacy: Check the Unknown Sources option.
Step 2: Settings > Additional Settings > Developer Options > Turn On USB Debugging
Step 3: Settings > Additional Settings > Developer Options > install Via USB
Step 4: Settings > Additional Settings > Developer Options > Turn off MIUI Optimization.
Step 5: Restart your Mobile.
I had an error of Session 'app': Error Installing APKs in Redmi 3S 6.0.1 MIUI Global 8.2. After turning OFF Instant Run in Android Studio, the error did not occur again. For this, Go to File Menu->Settings->Build, Execution, Deployment->Instant Run->Check OFF Enable Instant Run.
But I wanted to use Instant Run features, so,
Go to Settings-> Additional settings->Developer options->Turn off MIUI optimization. Restart phone.
Both of the above methods worked. If the error still occurs, check to Turn on USB debugging and Install via USB.
Open Security App pre-installed in MIUI
Then click Optimize. Try to achieve 100% score.
Activate developer's option by clicking multiple times on MIUI version. (Everyone knows how to do this)
Then Disable WiFi and switch on install via USB under Developers option while you are connected through Mobile data and under your Xiaomi account.
"Install via USB" wont work if your Xiaomi phone is running MIUI 8 or above. Looks like when you try to Enable this option, your phone trys to connect to some chinese server and fails.
I got a work around and it worked for me. Idea is to connect to Chinese-Shanghai server through VPN. Try the following:
1.Install PlexVPN from Playstore and login into it. You will a 24 hr free VPN service.
2.Select China-Shanghai server and connect.
3.From developer option in your Xiaomi phone, Enable "Install via USB".
You can then disconnect the VPN and logout from PlexVPN.
Enjoy!!
IF YOU HAVE TRIED EVERYTHING, TRY THESE STEPS ALSO
Step 0: Turn On MIUI Optimization & Restart.
Step 1: Settings > Additional Settings > Privacy: Check the Unknown Sources option.
Step 2: Settings > Additional Settings > Developer Options > Turn On USB Debugging
Step 3: Settings > Additional Settings > Developer Options > install Via USB
Step 4: Settings > Additional Settings > Developer Options > Turn off MIUI Optimization.
Step 5: Restart your Mobile.
Sometimes it happens because the user does not accept the installation in time. You can turn off "Monitor apps installed by USB" to override user confirmation.
Go to Settings-> Additional settings->Developer options->Turn off MIUI optimization
You must Turn on USB debugging and Install via USB
Hope it help
Follow the steps
Go to settings -> Additional Settings -> Developer Options(if not found then tap MIUI version in About phone multiple times) -> Turn off MIUI optimization.
GO to settings -> Mi Account -> Sign out(if signed in)-> developer options->turn on Install via USB(sign in page will open) -> Sign in to your mi Account
It should work,
if still these steps doesn't work for you then reboot your phone after these two steps
All the above instructions should work but if you're using MI Redmi Note 5A or later versions, you'll see that toggling "install via USB" toggles back off.
That's because the new versions somehow requires you to be in China. To fix this, download Windscribe VPN from playstore(it's free to use). Off your wifi and on mobile data. Connect to HongKong.
Go back and toggle "Install via USB". It'll work now. Disconnect the VPN.
Go to "Setting" → find "Developer options" in System
TURN OFF "Verify apps over USB" in Debbuging section.
I too faced similar issue after updating of Redmi to 8.5.7 OS but none of them mentioned above are worked. When I am trying to turn on Install via USB in developer options it is restricting.. So I did like following
Simply I did:
Logout from Redmi account
Relogin again
Turn on Install via USB in developer options
Update: if you still unable to tun on just switch off Wi-Fi and turn on mobile data and try to switch it on.
This solved my issue.
in miui 9 u must have access to the INTERNET to make it work
Step 1 : Turn on Developer Option (Settings > About Phone > Click 7 Times On "MIUI Version").
Step 2 : Connect Your Device via USB to PC
step 3 : Settings > Additional Settings > Developer Options > Turn On USB Debugging.
Step 4 : Also You Should turn On Settings > Additional Settings > Developer Options > install Via USB
for check, sometime just need go to:
Settings
Permissions
Install via USB (turn off your app if exist)
It was my case. Thanks #Jiyeh
You have to in able the install via USB mode, to do that
1.go to Settings=>Aditional setting=>Developer Options=>Install via USB tuggle it on, If you are having trouble tuggeling the option on,
2.You will have to insert a sim in and use a chineese VPN;
You can use a vpn of following setting:
tpye: L2TP/IPSec PSK
server address: vpn959922015.opengw.net
IPSec pre-sared key: vpn
username: vpn
password: vpn
3.And remember to turn on OEM unlocking in the developer options
and then appempt to turn on Install via USB;
Related
When installing new application from Android studio, the phone cancels the installation showing a notification that it's from unknown sources.
How can I authorize Android Studio app install on my device?
Notice: the device used is vivo y97 (Funtouch OS_9) connected to android studio using USB cable.
for running on real device you should follow these steps first:
Run Android App on Real device
You need to follow these steps to make your Android Device ready so that you can test your App.
Enable Developer Option
Enable USB Debugging
Install USB Drivers
Connect the Device to Computer
Enabling Developer Option
To Enable USB Debugging, First, we need to enable Developer Option on the phone. Google since Android Version 4.2 has disabled the Developer Option. This was done so that people do not enable the USB Debugging Mode accidentally. Enabling USB Debugging Mode puts your device into the security risk.
For the devices with Android Version lower than 4.,2 the developer Option is already enabled.
To Enable the Developer Option to follow the steps
Go to settings and tap on About Phone / About Device or About Tablet Option
Tap on Software Info Option
Locate Build Number and Tap on it seven times. You will see the message “You are now a developer” message. If the developer mode is already enabled then you will see the message “No need, developer mode has already been enabled”
Disable Developer option
In case you wish to disable the developer option you can go to Settings -> Application Manager. Select the Settings App. Select the Storage Option and clear the data. Note this will also reset your preferences within the settings menu.
Enable USB debugging
To enable USB Debugging, follow these steps
Go to Settings
Go to Developer Options
Goto USB Debugging Option and enable it
Disable Developer option
In case you wish to disable the developer option you can go to Settings -> Application Manager. Select the Settings App. Select the Storage Option and clear the data. Note this will also reset your preferences within the settings menu.
Enable USB debugging
To enable USB Debugging, follow these steps
Go to Settings
Go to Developer Options
Goto USB Debugging Option and enable it
Connecting Over Wi-Fi
Connect your device on the same wifi network as that of PC
Find out the IP Address of the Device. There are two ways you can find out the IP address.
Goto settings -> About Device
Tap on Status.
Or
Goto settings -> Wi-Fi
Tap on the Wifi Network connected
Locate the adb.exe. The adb is known as Android Debug Bridge is the tool that lets us communicate with a device. This tool is located under the platform-tools folder under the Android SDK folder.
The Android SDK folder can be found out by type SET ANDROID_HOME command. goto the folder
The adb is already running and listening on the USB port for the devices. To make it to listen to the TCP/IP Port number 5555 run the following command
adb tcpip 5555
Now, to connect the device run the following command
adb connect 192.168.0.103:5555
Replace the IP 192.168.0.103 with the IP Address of your device.
To disable TCP/IP and enable the USB, run the command
adb usb
To Find out the available devices
adb devices
Steps Followed:
Installed the USB Driver using the link: https://developer.samsung.com/galaxy/others/android-usb-driver-for-windows .
After successful installation, I tried to check the device if its getting listed by run the command adb devices.
I am not finding my device under the list of devices.
Make sure you have dev mode on your phone this is usually requires you to go to system and clicking the version number 5 times or so, then enable USB debugging once this is done under developer options.
Enable your ADB in your Android
-> First go to Settings->Developer Options
-> Then On or Enable your ADB Mode
Open your notification tab and check if it's showing USB connected or not.
If you click on that notification, it will give you options to chose to connect with USB under which mode.
There you can select 'File Transfer' mode.
Got this freaky error
Installation failed with message Failed to finalize session : INSTALL_FAILED_USER_RESTRICTED: Install canceled by user.
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!
Do you want to uninstall the existing application?
When trying to run the apk in my redmi 4 MIUI 8.5.4.0
OEM unlocking enabled
Solution Tried
MIUI optimization turned off
USB debugging turned on
Verify apps over USB turned on
NOTE: while turning on install via USB a pop up saying The device is temporarily restricted
Steps for MIUI 9 and Above:
Settings -> Additional Settings -> Developer options ->
Turn off "MIUI optimization" and Restart
Turn On "USB Debugging"
Turn On "Install via USB"
MTP(Media Transfer Protocol) is the default mode.
Works even in MTP in some cases
Set USB Configuration to Charging
In your mobile device,make sure you have enabled the following buttons.
Settings > Additional Settings > Developer options
Install via USB
USB Debugging (Security settings)
The device is temporarily restricted error appears in MIUI 8.5. To resolve the error you need to make WIFI off and make mobile data on and then enable the option “Install via USB” under "Developer Options" in "Settings". it will work for you.
For me none of the above solutions worked. Instead i do following steps that solved the issue :
Developer Options > Mi Unlock Status > Add account and device. (A success message will appear)
Turn on USB Debugging.
Turn on Install via USB.
Note : This is checked on Redmi MIUI Global 8.5 version.
This solution will specifically solve the issue if you have recently logged out of Mi account & again logged in.
Hope it may help someone.
In my case, I pressed Deny unfortunately during first time installation. So I was getting INSTALL_FAILED_USER_RESTRICTED.
You can get modify this permission for app under permissions.
Settings->Permissions->Install via USB->{Your App}
You should have enabled below options too.
Settings->Additional Settings->Privacy->Unknown Sources
Settings->Additional Settings->Developer Options->Install via USB
Settings->Additional Settings->Developer Options
1) Turn ON Developer Options
2) Turn ON USB Debugging
3) Turn OFF MIUI optimization
4) Turn ON Install via USB
For MIUI 12:
Developer options (On)
USB debugging (On)
Install via USB (On).
Allowed "Android System" to install from Unknown apps. (Try "More/Show system" if you can't see it in the list.)
This worked for me but got an android security warning.
For MIUI 9.6 works:
1. Become a developer: Settings >> About phone >> MIUI version tap 7 times.
2. Again Settings >> Additional settings >> Developer options (turn on) >> USB debugging (turn on) >> Install via USB (turn on).
3. You will be asked for permission through your MI account. Confirm permission.
4. Note: During the installation of the application, your device will give you 7 seconds to confirm the installation. Don't miss it!
For MIUI global 13 and above to turn off MIUI optimization
go to the developer option
go down where button one was "Reset to default values"
press it 5 times or more,
then the turn-off MIUI optimization is visible
Xiaomi MIUI.
Options - Permissions - Install via USB (not the same item in Developers options!)
then uncheck your disabled app
You have to enable developer mode then
settings -> additional settings ->
USB debugging: sets ON
Install via USB: sets ON (to do this you have to insert a sim card otherwise you'll not be
able to enable it)
[![enter image description here][1]][1]
[![enter image description here][2]][2]
Turn off MIUI optimization from Developer options
install the app
turn it back on.
next installs of this apk(and its updates) wont give this error anymore.
Reference
The same trouble with the same device has been here.
So, it's Xiaomi trouble, and here is a solution to this problem:
Go to the "Security" application and tap "Options" at top right
corner
Scroll down to "Feature Settings" group, and look for "Permissions"
At there switch off "Install via USB" option, which manages the
installation of the apps via USB and doesn't allow it.
On Latest Redmi Device:
Settings > Additional Settings > Developer Options > Developer options: Check the Install via USB option.
Just Disable Mock SD card optimization in the developer options
Turn off "Turn on MIUI optimization"
Mark force-closed apps
These Settings worked for me.Cheers!
If above answer didn't work for you as it didn't work for me on my Xiaomi Mi5.I tried to figure out the Core reason behind it and solve it. In MIUI, in order to change "Install via USB" option, you must be connected to the internet and signed in your Mi account. Due to some reason, requests from out of the China servers are getting rejected, so I connected to one open China VPN and tried again to enable 'Install via USB' and I got success. For detailed solution and VPN details, see this useful Youtube video: https://youtu.be/MeKUJlD-Ke4
For me, this works only
Steps for MIUI 9 and Above:
Settings -> Additional Settings -> Developer options ->
Turn off "MIUI optimization" and Restart
Turn On "USB Debugging"
Turn On "Install via USB"
Set USB Configuration to Charging
MTP(Media Transfer Protocol) is the default mode.
Works even in MTP in some cases
Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]:
Go to Settings->Additional Settings->Developer options->Developer Option(Need to enable)->USB debugging(Need to enable)->Install via USB (Need to enable)->USB debugging (Security settings)(Need to enable)
Perfectly working in the above steps.
Enjoy your coding...
To turn on "Install via USB" and "USB Debugging(Security changes)" need to sign in to xiaomi account then these 2 can be turned on and work with redmi as developer
Note:When turning on USB Debugging(Security changes) few security alerts will be poped up all need to be accepted to work on developer mode
How to Fix Install Failed User Restricted Failure in Android Studio -
For Xiaomi Redmi Note 4X (100% worked for me)
Settings=>Additional settings=>Developer Options
Mock SD card optimization = OFF
USB debugging = ON
Install via USB = ON
USB debugging (Security settings) = ON
Verify apps over USB = ON
Force-closed apps = ON
Turn on MIUI optimization = OFF
With Xiaomi Redmi note 8 pro (MIUI 10.4.4), Android 9 -
While connecting to Vysor (2.1.2) from Windows PC (via USB cable), received the error message:
"Error installing APK: Failure [INSTALL_FAILED_USER_RESTRICTED]"
even after turning "USB Debugging" On.
So the following settings were required -
Developer options (On)
USB debugging (On)
Install via USB (On)
Leave the following,
Turn on MIUI optimization (On)
Verify apps over USB (On)
Turn on usb debugging
Turn on Install via USB :->
While turning on it asks for mi account sign in you can get instant otp vis sms service to sign in quickly.
Turn off MIUI optimization.
Updated MIUI 12:
I have to turn on "OEM unlocking" beside other settings.
(I don't need to change "Mi Unlock status"
If it's still not working try adding android:exported="true" and upgrade your dependencies
It's simple, in MIUI 9.x you need developer settings ON and then
Settings -> (system & device section) Additional Settings -> Developer options
(Debugging section)
Turn On "USB Debugging"
Turn On "Install via USB"
Then in Android select Runb app and choose your Xiaome phone
EDIT: you will also need allow installation from unknown sources
what worked for me
goto Settings -> Additional Settings -> Developer options -> Revoke USB Debugging Authorizations.
Kill adb.exe in the taskmanager (CTRL + SHIFT + ESCAPE)
Install again, watch for popups (accept RSA signature and install)
Everything will work now
first, check your USB debussing options all mandatory should be enabled.
then uninstall the application from the device and then try to reinstall again.
this works for me.
Another possible reason in case if you have accidentally denied installing specific application - remove it from blacklisted.
It is under Security > Install via USB.
Note: You may not simply find it from Security. Instead search for "USB" from Settings search and look or that option in Security.
If your app is there - simply remove from the list. If not - then it's some other problem.
If you are still facing INSTALL_FAILED_USER_RESTRICTED issue try this
this methods works for me in miui 13
Setting->Permissions->Install via USB->untick your app
for more detail video
1) Turn ON Developer Options
2) Turn ON USB Debugging
3) Turn OFF MIUI optimization
4) Turn ON Install via USB
youtube video for more visual understanding
For me only installing from Google drive worked.
I'm having this error:
$ adb push
F:\skylixwork\CollagePhoto\app\build\outputs\apk\app-debug.apk
/data/local/tmp/com.collagephoto java.io.IOException: An existing
connection was forcibly closed by the remote host
Error while
Installing APK
Installation failed with message INSTALL_CANCELED_BY_USER.
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!
Do you want to uninstall the existing application?
Works !
enable developer mode - In your phone, go to Settings, About phone and click on MIUI version 7 times. You’ll see a pop up which says you are a developer now.
Go back to Settings, Additional settings, Developer options and enable USB Debugging.
Connect your phone to your PC/Mac and on the phone authorize your computer
go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. Your phone will be rebooted
I solved my issue this way.
I found the answer for my question.
solution :- (1)
enable developer mode - In your phone, go to Settings, About phone and click on MIUI version 7 times. You’ll see a pop up which says you are a developer now.
Go back to Settings, Additional settings, Developer options and enable USB Debugging.
Connect your phone to your PC/Mac and on the phone authorize your computer
go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. Your phone will be rebooted
solution :- (2)
enable developer mode - In your phone, go to Settings, About phone and click on MIUI version 7 times. You’ll see a pop up which says you are a developer now.
Go back to Settings, Additional settings, Developer options and enable USB Debugging.
Connect your phone to your PC/Mac and on the phone authorize your computer.
go back to Developer options, scroll down to find Install via USB: and just turn on it.
I'm using xiaomi redmi note 4x and after Turning on install via USB, Turning off MIUI optimization is the main objective from developer option to run app via USB! This works for me
I will suggest to check update of adb version. Aslo check the your Run Apps on a Hardware Device
For more information refer this solution ADB connection
Try above solutions. hope it will work
1 adb devices check your device is ok
2 reboot your devices
3 adb install -r F:\skylixwork\CollagePhoto\app\build\outputs\apk\app-debug.apk
When I try to "run" app via Android Studios, my Xiaomi Redmi Note 3 doesnt pop up in the list. However, it does show up in my PC file explorer.
Things I've done;
-tried to install both Xiaomi's own usb drivers and Google's usb drivers, with the same result; "No newer drivers are available"
-enabled usb debugging, makes no different
-switching between PTP and MTP mode
Could anyone help me?
=> For Enabling to developer Mode In Redmi Note 3 :
1: Go to Setting.
2: Click to "About phone" option.
3: Press 7 times to "MIUI version" option.
now you will see a Toast message "now you are developer".
=> Now you should install to Mi PC Suite from this .
1: Install the pc suite with connected your redmi.
2: Now go on Permission in setting and click "install via USB".
=>For Enabling USB Debugging :
1: Open Settings > Additional settings > Developer options.
2: Firstly enable to developer options then go below and find USB Debugging and enable it.
3: When your pc suite open then again repeat disable and enable to USB Debugging
For Redmi 4a also follow :
Open Settings > Additional settings > Developer options > Select USB Configuration > MTP.
I am not sure if you are always looking for a solution. However, I had the same problem, and to fix it, just try the following steps (it works for me):
Go to Settings > Additional settings > Developer options
Disable the "Turn on MUI optimization"
Reboot your phone
It should work after rebooting your device.
Good luck
Xiaomi interface has a lot of "locks".
To use your Xiaomi device to test your apps you need to:
enable developer mode:
Settings > About Phone > MIUI version.
Tap the MIUI version message until you receive a message telling you that you are a developer.
enable usb debugging (inside the developer menu).
enable fast-booting (I don't know if this one is necessary).
install the Mi PC Suite.
Use a USB port from behind of your computer.
allow third party's apps on your device.
Go To Settings > Additional Settings > Developer Options
Now Enable these options
USB Debugging
Install Via USB
Select USB Configuration to MIDI
Go to Settings
Go to Additional settings
Go to Developer options
Disable the "Turn on MUI optimization"
Reboot your phone
It will work
I Found this answer on Quora
(Worked like a Charm in my case , tried other methods previously but they didn't work for me)
COMPILATION OF ALL POSSIBLE STEPS.TRUST ME IT WORKS!
I would like to improve this answer. Once you have enabled being a developer
1.Settings->About Phone->MIUI version .Click on it for seven times.
2.Go to Additional settings->Developer Options.Now you will have to enable two options in this.
a.USB debugging
IN developer options,Scroll to the end to find TURN OFF MIUI OPTIMIZATION.And you may need to reboot your phone.(no issues,nothing will happen).
And if it says you have temporary issues, disable Wi-Fi and enable your mobile network.Even then if it does not allow,
3.Settings->under APP SETTINGS section->Permissions.
Click on the top right corner and slide over the option INSTALL VIA USB.
Now don't forget to go back to Settings->Developer Options->Install via USB(enable).
When all these steps are done together, it works perfectly else,
In your android studio,
Go to FILE->SETTINGS->BUILD,EXECUTION,DEVELOPMENT.Under this,uncheck enable instant run.
I've been trying to look for the possible answers for almost a year now on my MI note 4.And it finally worked today.Happy to share.Enjoy.
For Xiaomi Redmi 6, in Developer options do the following:
Enable USB debugging
Enable Install via USB
Disable Turn on MIUI optimization
On Select USB configuration select MIDI (this is what solved the problem for me)
Also, take a look at this question: ADB is not recognizing my Redmi Note device
I bumped into the same issue
Run below on terminal to find your VENDOR ID;
lsusb
This will display information about USB buses in the system and the devices connected to them.Then, find your phones vendor id (it will be probably without any company names) and type,
sudo gedit ~/.android/adb_usb.ini
and your adb_usb.ini file should look like:
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
# ie 0x2207
0x<!!!Your Vendor ID here!!!>
Disconnected and reconnected device and also needed to run below commands on terminal;
sudo adb kill-server && adb start-server
And the device was detected.
I solved a problem with connection of Xiaomi Redmi 4 Pro (I hope problem is common for Note 3 too) to Android Studio.
I did next steps:
First of all enable Developer Mode. I won't dublicate how to do it, as it was described here many times.
To solve problem with ADB Interface driver, I've installed Mi PC Suite - MiSetup3.2.1.3111_2717 (link to download)
As output from adb devices command still shown me empty list of connected devices, I tried to use original USB cabel which came with my phone instead of some Xiaomi's USB cabel bougth earlier, and it helps! Phone successfully connected to Android Studio and I installed my test apps!
Hope it will help you guys too.
MI Devices developer mode enable option is quite different. Please refer the below screenshots for the detailed understanding.
In the MI Devices developer mode options stays inside the Additional Setting
Just
goto Additional Settings > Developer Option > there at the bottom just turn off MIUI optimization.
Then
Enable:
USB debugging
Install via USB
USB debugging (Security settings)
Worked for me.
cheers
In some rare cases,the problem is windows "Administrative Templates"
My Xiaomi redmi 2 can't connect with Android Studio although I've done Everything That people say above.
But in my Case I found a solution :
put gpedit.msc in windows command
go to "Administrative Templates" -> "System" -> "Removable Storage Access"
Disable:
-Removable Disk: Deny execute access
-Removable Disk: Deny read access
-Removable Disk: Deny write access
-All Removable Storage classes: Deny all access
Plug on your device
Run app
Don't worry dude .....
first turn on USB debugging...
then Turn on Install via USB...
just turn off your MIUI optimization ....
then it'll ask to restart...
restart your mobile and then it should work....
I hope this will help...
and it worked on my MI 3s prime
application installation failed message failed to establish session ....
Settings > About phone > keep tapping ‘ MIUI version ‘ until it says you’re a developer.
Settings > Additional settings > developer options> toggle ‘USB debugging'
Settings > Additional settings > Developer options> toggle ‘Install via USB'
TRY THIS ONE.THIS WILL WORK.
Update your MIUI version to 7.3.5.0 and you should install drivers in your pc.
Driver link
It seems that the ADB interface wasn't updated properly.
Try this: ADB is not recognizing my Android Device
or https://stackoverflow.com/a/31489453/7030003
This worked for me!
"Install via USB" wont work if your Xiaomi phone is running MIUI 8 or above. Looks like when you try to Enable this option, your phone trys to connect to some chinese server and fails.
I got a work around and it worked for me. Idea is to connect to Chinese-Shanghai server through VPN. Try the following:
Install PlexVPN from Playstore and login into it. You will a 24 hr free VPN service.
Select China-Shanghai server and connect.
From developer option in your Xiaomi phone, Enable "Install via USB".
You can then disconnect the VPN and logout from PlexVPN.
Enjoy!!
First, you have to make sure that you have DEVELOPER MODE on. To turn on,
Go to About phone
Tap the MIUI version until it shows the message that "You are now a developer."
When successful, you can now access developer options in Additional settings in the main Settings.
Go to developer options and enable USB debugging mode.
Secondly, to make sure it allows your phone to used via ADB. Download the necessary USB driver.
This can be done via Android Studio by going to SDK Manager --> Tools --> Google USB Drivers --> Install this.
To avoid the "INSTALLATION_CANCELLED_BY_USER" error, do this:
Go to the "Security" application and tap "Options" at top right corner.
Scroll down to "Feature Settings" group, and look for "Permissions"
At there switch off "Install via USB" option, which manages installation of the apps via USB and doesn't allow it.
On Latest Redmi Device,
Settings > Additional Settings > Developer Options > Developer
options: Check the Install via USB option.
Once installed, you will be able to use your Xiaomi device for App Testing.
If nothing works then do these steps:
Turn on USB Debugging in Developer options.
Turn On USB Tethering too.
For USB Debugging go to:
Settings > Additional Settings > Developer Options > USB Debugging
For USB Tethering go to:
Settings > More > USB Tethering
Now it should work. Mine works.
Thankyou.
My Redmi Note 4 had a same issue but after installing HiSuite everything worked fine.
For Redmi 5 Plus : Make sure to also download and install the Mi Pc Suite.
100% your MI phone will be detected by android studio by using following steps
1) first you have to turn on developer mode
2) turn on usb debugging
3) Install MI ADB driver from below link you must to login first before downloading
https://c.mi.com/thread-1625831-1-1.html
4) Your phone will be shown in Android studio...Enjoy
For all the Mac Users
Just follow the instructions in one of the other answers, for example the answer from Bhunnu Baba.
Since Mi PC Suite isn't available for Mac, use an alternative software. I tried SyncMate and it worked like a charm. An important thing is that you also have to install the SyncMate App on your Xiaomi.
PS: I use a Xiaomi Redmi 9t
In my case, I'm using a Redmi 9, and it was not being monitored by USB in my Mac.
Solution: Settings > Developer Options > Standard USB Configuration > Select File Transfer
In a recent Xiaomi update, there are now twice USB-Debugging options available. In both version, USB-Debugging needs to be activated in order to connect successfully with Android Studio.