Xamarin failed to deploy app to emulator with: “Unexpected install output: cmd: Can't find service: package”

后端 未结 5 1109
终归单人心
终归单人心 2020-12-17 08:01

I\'m building the sample intro xamarin forms app With Visual studio 2019 and the emulator boots up but the app doesn\'t deploy with the error Unexpected install outp

相关标签:
5条回答
  • 2020-12-17 08:28

    Just factory reset the device and let it build over. That should do the trick

    0 讨论(0)
  • 2020-12-17 08:33

    Last week I used My Device (red box in screenshot) without issue. This week I was getting:

    Mono.AndroidTools.InstallFailedException: Unexpected install output: cmd: Can't find service: package

    Tweaking Reza's answer I created a new emulator in the same project, My Device 2 (purple box in screenshot), and it works on that device.

    0 讨论(0)
  • 2020-12-17 08:33

    In my case it helped to do a Factory Reset of the emulation device in the Android Device Manager.

    0 讨论(0)
  • 2020-12-17 08:42

    SOLUTION FOR MANY ISSUES THAT I'VE FACED:

    As user5389726598465 mentioned, "Switching from Android 9.0 Emulator to Android 8 Oreo image" makes Visual Studio to uninstall a Mono shared runtime and install a new one. It's like a Mono repair it seems.

    Here are the steps within Visual Studio:

    1- Create a project/solution.

    2- Go to Tools > Android > Android SDK Manager.

    3- Install your desired Android with all its components. e.g. Android 8 Oreo. (wait for the installation to finish!)

    NOTE: If you're using Visual Studio 2019 like me you have to go with Android 8.1 Oreo or higher.

    Now you can uninstall the old one - optional.

    4- Go to Tools > Android > Android Device Manager.

    5- Create a new device/Emulator with exactly the same OS and API version which you chose in step 1. (Do NOT go with x86_64 Processor to avoid random errors)

    6- Under Solution right-click on myApp.Android project > Properties > Application > set Compile using Android version: (Target Framework) TO select your matching Android version .

    7- Android device manager > Run. (Wait for Android Emulator to completely boot up.)

    8- Clean then Build your solution.

    9- Run the solution and wait. (This step might take more than 20 minutes for the first time with no visualizing process. Leave the computer, be patient and don't break the program until you see your output on the Emulator screen!)

    Well done!

    0 讨论(0)
  • 2020-12-17 08:44

    As a workaround, switching from an Android 9.0 Emulator to Android 8 Oreo image solved the problem.

    0 讨论(0)
提交回复
热议问题