问题
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.
回答1:
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
回答2:
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!
回答3:
Turn off Miui Optimizations on Developer Settings, then Restart the phone.
it worked for me.
happy coding ...
回答4:
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 ... :-)
回答5:
In my case I turn on "Install via USB" and also make sure "USB Debugging" is on.
回答6:
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.
回答7:
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.
回答8:
- 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.
回答9:
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.
回答10:
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.
回答11:
Go to Settings-> Additional settings->Developer options->Turn off MIUI optimization You must Turn on USB debugging and Install via USB Hope it help
回答12:
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
回答13:
"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!!
回答14:
- Go to "Setting" → find "Developer options" in System
- TURN OFF "Verify apps over USB" in Debbuging section.
回答15:
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.
回答16:
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
回答17:
for check, sometime just need go to:
- Settings
- Permissions
- Install via USB (turn off your app if exist) It was my case. Thanks @Jiyeh
回答18:
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;
回答19:
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.
来源:https://stackoverflow.com/questions/29444980/android-install-on-device-failure-install-canceled-by-user