2

I am developing an app in android studio and I use xiaomi mi a1 to run it on it. I turned on USB debugging and USB tethering and I do see the phone in android studio devices. The problem is that when I try to run it after some time it says "Error Installing APK".

Notes:

  1. I turned off insta run.
  2. When android 8 was on my phone everything worked just fine. Since I installed android 9 it stopped working.

Anyone knows what's the problem or how to fix it?

EDIT: When I turned off insta run there was no error but it kept "installing apk's" for about 20 minutes and the app didn't load on the phone (On other phones it took max 1-2 minutes).

Cœur
  • 37,241
  • 25
  • 195
  • 267
Netanel
  • 477
  • 2
  • 11
  • does your project location(and its parent directories) contains any special character? Happened to me a while back – abhndv Feb 05 '19 at 10:29
  • What type of error it's showing when you click on `Error Installing APK` – Kishore Jethava Feb 05 '19 at 10:31
  • @newton_cr7 I don't think the problem is with the project because on other phones it runs just fine (tried on lg g7) – Netanel Feb 05 '19 at 11:24
  • @KishoreJethava I am gonna check soon and reply to you. I just remembered that there was no error after I turned off insta run but it still didn't work (added that to the question) – Netanel Feb 05 '19 at 11:25
  • If the app is already installed, try to uninstall and reinstall the app. – kAliert Feb 05 '19 at 12:01
  • Turn off **MIUI Optimizations** and then trying installing the apk from Android Studio. – Srikar Reddy Feb 05 '19 at 12:12

1 Answers1

1

Settings -> Additional Settings -> Developer options ->

1) Turn off "MIUI optimization" and Restart

2) Turn On "USB Debugging"

3) Turn On "Install via USB"

4) Set USB Configuration to Charging

Make sure you have insert sim in your mobile, else app will not installed in your mob and always through error.

Erselan Khan
  • 692
  • 6
  • 13
  • Hi, I don't see MIUI optimization in my phone. Maybe it has something to do with me using Android 9? Also in the usb configuration there is no option for charging. (I am using xiaomi mi a1) – Netanel Feb 07 '19 at 17:47
  • scroll to bottom to find MIUI optimization option – Erselan Khan Jul 08 '19 at 10:23