0

I'm building an Xamarin android admin app meaning that the app will be the device admin but in order to be able to uninstall the app while developing I need to add to the android manifest android:testOnly="true" but then it fails at deployment I get the following error

Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

and to avoid that error I need to pass an install flag with adb as written this stack overflow answer

how do I do that in VS.

Joe B
  • 738
  • 7
  • 28

1 Answers1

0

First of all, please archive your application then export the xxx.apk file. Note: when you archive your application, please notice following settings.

  1. unselect following settings enter image description here

  2. select following settings. enter image description here

For example, I archive my application to root path of F desk like following screenshot.

enter image description here

Then, open the adb command to click the icon like following screenshot.

enter image description here

Enter the F: in the adb console. Then enter the adb install -t -r com.companyname.app25.apk like following screenshot(please make sure your android emulator is running).

enter image description here

In the end, you will found your apk file was installed. enter image description here

Leon
  • 8,404
  • 2
  • 9
  • 52
  • Thanks. but how do I attach it to the debugger? – Joe B Jun 03 '20 at 14:57
  • Based on my research, If you use this way to install your APK by `ADB`, you cannot debug it by VS, you have to see logs in the logcat. If the reply is helpful, please do not forget to accept this answer(click the✔ in the upper left corner of this answer), it will help others who have similar issue. – Leon Jun 04 '20 at 05:46
  • I can't say its answered because the real answer is that you cannot pass install flags when deploying with VS while debugging. the question was not how to archive the application and install it via adb – Joe B Jun 11 '20 at 21:13
  • Ok. If used this way, it can achieve it. – Leon Jun 12 '20 at 08:37