Xamarin deploying not working with Android

18,211

Solution 1

You need to first set the Android project as the Startup Project. Right click the Android Project and select Set as StartUp project.

Ensure that you have checked the Build and Deploy checkboxes. You can right click the Solution and select Configuration Manager.


Also, please ensure that the Emulator is already running.

You need to wait for the emulator to full start - takes about a few minutes. Once it is fully started (UI on the emulator will change), it should work.

You will need to restart the app after the emulator is running and choose the running emulator (when prompted).

Solution 2

This can be caused by a few things. When ever I get this, I switch the Output window drop-down to Build. Usually that shows an INCOMPATIBLE error of some kind. That usually means the app install on the device/emulator got corrupted/messed up in some way. The app probably will not even show up on the app dashboard area but if you go into Settings -> App (or App Manager) -> then look for the app's App ID (NOT the app's name). When you find it, uninstall it and try again.

Another common cause of the error for me is that the correct architecture is not selected in the Android project properties. This usually is the case when trying to run on the Xamarin Android Player. To fix that, right-click the Xamarin Android project -> Properties -> Android Options -> Advanced -> select x86

Solution 3

This means you are deploying to a device/emulator with an app that doesn't contain the appropriate architecture.

So let's make sure you have the following, first go to your android project options and make sure you have these checked:

enter image description here

Then you might also need to click Advanced on this screen and check the appropriate architectures:

enter image description here

Share:
18,211
Niklas Raab
Author by

Niklas Raab

Updated on June 05, 2022

Comments

  • Niklas Raab
    Niklas Raab almost 2 years

    I've set up a new Xamarin.Forms Project. I want to build and deploy it to an emulator or an Android device, but it is not working. In the Outputwindow of Visual Studio, the following error is displayed:

    The application could not be started. Ensure that the application has been installed to the target device and has a launchable activity (MainLauncher = true).

    Update:

    If I look in the build logs i can find following:

    2>Mono.AndroidTools.InstallFailedException: Unexpected install output: Error: Could not access the Package Manager. Is the system running?

    2> bei Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)

    2> bei Mono.AndroidTools.AndroidDevice.c__AnonStoreyD.<>m__0(Task`1 t)

    2> bei System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()

    2> bei System.Threading.Tasks.Task.Execute()

    2>Deployment failed because of an internal error: Unexpected install output: Error: Could not access the Package Manager. Is the system running?

  • Niklas Raab
    Niklas Raab almost 8 years
    I heard thats sometime the problem, but i checkd this. Please look in the Question, there are new Informations.
  • Niklas Raab
    Niklas Raab almost 8 years
    Thanks for the tip ;-). Please look in the Question, there are new Informations.
  • Anubhav Ranjan
    Anubhav Ranjan almost 8 years
    The error generally happens when the Emulator is still starting up. Make sure that the Emulator is already running.
  • Niklas Raab
    Niklas Raab almost 8 years
    Thank you for the help. Now I am able to start the App, if the emulator is running.
  • Anubhav Ranjan
    Anubhav Ranjan almost 8 years
    Great that the issue is resolved for you now! You can mark the answer as resolved so that it can be of help to others.
  • Niklas Raab
    Niklas Raab almost 8 years
    Sorry, i forgot :)
  • Christian Findlay
    Christian Findlay over 5 years
    I have the app set as the startup project, and I have the project set up for build and deploy but I still get the error. I'm getting this with my Android phone - not the emulator.