10

I am trying to install the app but Android Studio showing error:

Launching 'app' on Xiaomi Redmi 4A.
Installation did not succeed.
The application could not be installed.
...
Installation failed due to: 'Connection refused: connect'

How do I fix this error?

Ola Ström
  • 4,136
  • 5
  • 22
  • 41

3 Answers3

7

If this happened on Android Emulator you can simply:

  • Clean Project

then

  • Rebuild Project

enter image description here

Ola Ström
  • 4,136
  • 5
  • 22
  • 41
Krzysiulele
  • 346
  • 5
  • 11
1

Steps for MIUI 9 and Above:

Settings -> Additional Settings -> Developer Options -> Enable USB Debugging, Enable Install via USB , Enable USB Debugging(Security Settings)

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

1

This error occurred because your system settings disabled proxy and you build android project using proxy event. You don't know that you're enabling proxy to find out most of people go to android -> gradle.properties this is right but you need to check on your system pc's gradle.properties file. I'm using a mac, so in my case this file is in mypc/.gradle/gradle.properties. In this file you can remove proxy related code.

This solution worked for me and maybe it works for you as well!

Daan Seuntjens
  • 880
  • 1
  • 18
  • 37