Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin deploying not working with Android

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?

like image 934
Niklas Raab Avatar asked May 31 '16 12:05

Niklas Raab


2 Answers

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).

like image 196
Anubhav Ranjan Avatar answered Sep 19 '22 20:09

Anubhav Ranjan


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

like image 20
Rajon Tanducar Avatar answered Sep 17 '22 20:09

Rajon Tanducar