c# – Xamarin – Android – Visual Studio – The application could not be started-ThrowExceptions

Exception or error:

I was working on an Android project using Xamarin in Visual Studio 2012. I recently upgraded from an HDD to a SSD so I reinstalled Windows and all of my programs.

After cloning my git repository and trying to run the application on my device, I have not been able to get it to run. I was able to start a new hello world project and I got that to run, but I can’t get this project to run.

This is what the error says:

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

Additionally, check Build->Configuration Manager to ensure this project is set to Deploy for this configuration.

I have searched for a solution to this issue but have been unable to find anything that worked.

How to solve:

I solved the issue. Somehow the application still existed on my device even though it did not show up in my applications and I needed to remove it.

The solution was to find an old APK that I had emailed and I installed that. Then I uninstalled the application and deployed it again from Visual Studio. This time it worked.

You can read more here: https://forums.xamarin.com/discussion/8501/install-failed-update-incompatible

EDIT (March 13th, 2017):

Seems a lot of people found this answer useful so I decided I should update it with an alternate method to uninstall the app if you don’t have access to an old version.

As Atul Chaudhary and Nestel mentioned, you can open up your adb command prompt and run adb uninstall <com.your.application.package.name>. If there are any remnants of your application which remain this should get rid of them.

###

enter image description here

  1. Renamed Application name.

  2. Added Package name.

App. started working on Emulator, Renamed application again, app. continued to run.

Note: Resetting device, un-installing the app. and related runtime etc. from settings did not work for me.

Hope this helps someone.

###

Running this command from the adb shell solved it for me:

adb shell pm uninstall -k com.packagename

To access the adb shell from Visual Studio Tools -> Android -> Android Adb Command Prompt.

Very interesting error, seems like Visual Studio is unable to unistall the previous version completely.

###

Obviously the OP figured out the issue to their problem but I still wanted to post an answer relating to an issue I had with the same error message. I am using Visual Studio (within Parallels) and attempting to debug the app on a Xamarin Android Player instance (which is running on my Mac).

I kept getting this error and realized that a different, more helpful, error message was showing up in the Build Output saying that I was not supporting the correct architecture.

Heading into the Android Project Properties -> Android Options -> Advanced -> and checking x86 finally allowed my to successfully deploy to the Xamarin Android Player.

###

The ADB approach does not worked for me.
I did not want to factory reset my phone nor uninstall my apps so I have managed to deploy by changing the package.

  1. Right click on your Droid project
  2. Select Properties
  3. Got to Application Manifest
  4. Change the Package name
  5. Re-deploy your project
    enter image description here

Hope this helps

###

I had the same error today, trying to run Xamarin Android-app on Xamarin Android Player. To fix it I needed to check the “x86” box at the “Supported architectures” section. So you might want check this section.

###

I experienced this problem when there was not sufficient memory on device. After “successful” deployment the app was missing even from the app list in Settings. Deleting through adb gave me Failure which indicated it was not installed. In Output log in VS2015 I was having the same message as OP. Finally it worked after I cleaned up about 50-100 MB, even though in App Settings it showed me that there were 500 MB free. I tried different solutions (deleting through adb, cleaning, building then deploying) but only cleaning up worked.

###

adb uninstall did the trick. The strange thing is that even if you run the command to list all app that are installed it will not show up but if you run the uninstall command with ur package name which should be ur project name or name that you have assigned you will get the success result which means it got uninstalled and to check that if run the uninstall command again with same package name u will get failure command. Then deploying ur package again should work

###

In my case issue was two activities were Launcher activities,so I made one of them Launcher activity.

You can remove
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
from AndroidManifest.xml file or
MainLauncher = true from .cs Activity file attribute

###

If you’ve reinstalled everything you may have to set the configuration manager back up in VS.

In Visual Studio: Build -> Configuration Manager -> Put a check in the “Deploy” box.

###

I’ve managed to solve it by wiping user data from emulator.

From AVD Manager, when you start the emulator, check “Wipe user data” and your emulated device will behave like new.

Problem itself appeared after updating to Android SDK Tools 25.1.3.

###

I could not get this working, initially. Tried removing everything (Mono runtime, app, etc.), but to no avail.

What did work was renaming my package, which was fine in my case since I haven’t release my apk yet. Some ghost version is obviously still stored on my unit.

###

Renaming Application Name and Package Name (go to Manifest settings) where helped to resolve this issue

###

The only alternatives which help me solve this were the following:

  • From the Xamarin Android Studio home page (where all devices are displayed), click on the “three-dots” button and then Factory Reset.

OR

  • Install a new device and deploy your app there.

###

Whenever I encounter this problem, I publish the app and install in manually using

adb install "<path to apk file>"

in the Android Adb Command Prompt.

Hopefully, a fix is out soon, according to
https://github.com/xamarin/xamarin-android/issues/3727

Leave a Reply

Your email address will not be published. Required fields are marked *