1

Since the time I have updated android studio to 3.5, I have been unable to run any app on multiple of my physical phones (Redmi Note 4 and OnePlus6). The app isn't installing on any of them. But it is installing on the emulated devices of the same respective versions (Android 24 and Android 28), so it is not an issue with the code.

Moreover, I tried to build the previous versions of my app stored on Git, and now Android Studio does not build the app showing - "linking error". While that same code version was working fine a few months ago (prior to the android studio update). Which is why I think the problem is somehow with the Android Studio and not the code...

Things I have tried

  1. Disable instant Run (Not an option anymore in Android Studio >=3.5.1)

  2. Enable USB debugging, connect using the device using "Transfer Files" mode and not "Charging Device" Mode

  3. Turn off MIUI Optimization and Reboot

  4. Uninstall App and re install

  5. Build the apk, transfer the apk to the device and then try the install (This works on OnePlus 6 but not on Redmi Note 4)

The apps I have tried target Sdk >=27, and use androidx. However, I tried to go back to a previous version of the app, which didn't use androidx (and used the legacy support libraries), but still got the same error.

My system is Ubuntu 18.04, and current Android studio version is 3.5.3

Errors I have been getting include:

  • INSTALL_FAILED_USER_RESTRICTED
  • Device Not Found

UPDATE: - Just tried to install on OnePlus6, doesn't install there as well. Earlier I had tested only for Redmi Note 4. - Tried uninstalling and reinstalling the app, building the apk and transferring on the phone then manually installing. - This is happening across projects, at least for Redmi Note 4. I tried this with one of my course projects, same/similar problems.

My guess is problems with Android Studio update and the recent migration to androidx from the "legacy" support libraries

  • What is the exact log? Linking error often means there is a problem in your code. – CoderCharmander Dec 13 '19 at 15:54
  • Have you tried uninstalling the app from your phone and start fresh? Sometimes I get like a partially installed app, like only the package name appears and I need to uninstall that as well to make it work. – Marc Laliberté Dec 13 '19 at 16:07
  • Are there two different accounts like user and owner. Try to go main account and uninstall from there – Ankit Tale Dec 13 '19 at 17:26
  • @CoderCharmander, linking error is not that often. And you are right, it does mean problems in my code. But that also seems to occur due to androidx – Palash Aggrawal Dec 13 '19 at 17:35
  • @MarcLaliberté yes I tried uninstalling and reinstalling. I even tried to build the APK and then install on my phone by transferring the APK on my phone and then installing. But I get package corrupt error on Redmi Note 4 (This works on OnePlus6 thought) – Palash Aggrawal Dec 13 '19 at 17:36
  • @Venky I don't think Redmi has user/owner accounts. Even if it does, I have only signed in with one Mi Account. So I am pretty sure that multiple accounts is not the case – Palash Aggrawal Dec 13 '19 at 17:37

2 Answers2

1

How I solved it:

Disable "Use libusb backend" in the Settings -> Build, Execution and Deployment -> Debugger

Screenshot of the settings page where we need to disable "use libusb backend"

Sorry Android Studio 3.5 for the curses

How I found the solution:

I checked the logs of android studio by going to Help -> Compress Logs and Show in Files. In the folder which opened, I saw the logs by the name adb.1000.log (because adb - android debug bridge, handles the communication with the device). In the last few lines I saw - "read transfer failed: LIBUSB_TRANSFER_CANCELLED". I read here about the option of libusb

0

Did you try to clean/rebuild... under /Build/Clean Project, after that /Build/Rebuild Project and after cleaning and rebuilding you can try under /File/Invalidate caches

  • Yes, tried that. Clean Rebuilding, even deleting .idea files and recreating the project didn't help because of the above setting – Palash Aggrawal Dec 31 '19 at 07:37