Application could not be started
<p>I am unable to get my application to run an Android device from Visual Studio 2015/Xamarin. It fails to start on the device, giving this message:</p>

<pre><code>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-&gt;Configuration Manager to ensure this project is set to Deploy for this configuration.
</code></pre>

<p>So I added the decorator <code>[Activity(MainLauncher = true)]</code> to the MainActivity.  </p>

<p>I checked that in <code>Build-&gt; Configuration Manager</code>, AnyCPU, Build, and Deploy are checked.</p>

<p>Restarted, same result, did not start on device and gives same messages.  </p>

<p>A <a href="https://stackoverflow.com/questions/34294649/xamarin-android-visual-studio-the-application-could-not-be-started">post on StackOverflow</a> suggests that the previous app may not have been entirely removed, so issuing this command from the adb shell:  </p>

<pre><code>adb -s 09103e9 shell pm list packages 
</code></pre>

<p>shows the packages on the device:</p>

<pre><code>package:com.google.android.ears
package:com.android.launcher
package:com.android.defcontainer
package:com.rovio.popcorn
package:com.nuance.xt9.input
package:com.google.android.exchange
package:com.android.providers.partnerbookmarks
package:com.android.contacts
package:com.google.android.nfcprovision
package:com.android.phone
package:com.android.calculator2
package:com.android.htmlviewer
package:com.google.android.gsf.login
package:com.android.bluetooth
package:com.android.providers.calendar
package:com.google.android.email
package:Mono.Android.Platform.ApiLevel_23
package:com.android.providers.downloads.ui
package:com.mobilerise.mystreetview
package:com.android.documentsui
package:com.android.sharedstoragebackup
package:com.android.vpndialogs
package:com.android.providers.media
package:com.google.android.marvin.talkback
package:jp.co.omronsoft.iwnnime.ml.kbd.white
package:com.android.certinstaller
package:com.google.android.deskclock
package:com.google.android.gms
package:com.google.android.apps.currents
package:com.google.android.setupwizard
package:com.example.android.osmdroidofflinedemo
package:com.android.settings
package:com.meraki.sm
package:com.google.android.street
package:com.hp.android.printservice
package:com.google.android.googlequicksearchbox
package:com.google.android.music
package:com.android.musicvis
package:eu.thedarken.sdm
package:com.android.wallpaper.livepicker
package:com.google.android.inputmethod.latin
package:net.osmand
package:com.android.packageinstaller
package:com.google.android.backuptransport
package:com.google.android.apps.chromecast.app
package:com.google.android.tts
package:com.android.providers.telephony
package:com.android.noisefield
package:com.google.android.apps.maps
package:com.google.android.apps.cloudprint
package:com.funtrigger.appinstaller
package:com.wf.wellsfargomobile
package:com.pandora.android
package:com.android.wallpapercropper
package:com.android.location.fused
package:com.android.backupconfirm
package:com.android.providers.settings
package:jp.co.omronsoft.iwnnime.ml
package:si.formias.keepscreenon
package:com.google.android.apps.docs
package:com.android.providers.downloads
package:com.amazon.mp3
package:com.android.browser.provider
package:com.android.musicfx
package:com.google.android.apps.books
package:com.android.phasebeam
package:com.google.android.videos
package:com.google.android.inputmethod.pinyin
package:com.google.android.gallery3d
package:com.google.android.onetimeinitializer
package:oliver.ehrenmueller.dbadmin
package:com.esri.arcgis.collector
package:com.google.android.partnersetup
package:com.wunderground.android.weather
package:com.adobe.reader
package:com.android.proxyhandler
package:com.android.inputdevices
package:com.andrewshu.android.reddit
package:com.android.wallpaper.holospiral
package:com.google.android.feedback
package:com.google.android.talk
package:com.android.nfc
package:com.google.android.apps.enterprise.dmagent
package:com.android.providers.userdictionary
package:com.google.android.inputmethod.korean
package:com.google.android.configupdater
package:com.android.pacprocessor
package:com.quickoffice.android
package:com.google.android.keep
package:com.android.printspooler
package:android
package:com.android.providers.contacts
package:com.techsmith.apps.fuse
package:com.android.externalstorage
package:com.mictale.gpsessentials
package:com.estrongs.android.taskmanager
package:com.android.dreams.basic
package:com.google.android.apps.plus
package:com.android.vending
package:com.google.android.play.games
package:com.android.systemui
package:com.android.keychain
package:com.google.android.gm
package:com.google.android.tag
package:com.android.wallpaper
package:com.google.android.GoogleCamera
package:com.estrongs.android.pop
package:com.google.android.apps.magazines
package:com.google.android.youtube
package:Mono.Android.DebugRuntime
package:com.google.earth
package:com.google.android.gsf
package:com.android.keyguard
package:com.google.android.calendar
package:com.android.facelock
package:com.android.chrome
package:com.android.shell
package:com.google.android.syncadapters.contacts
</code></pre>

<p>None of these are the application. Some suggestions on the web are to remove the
Mono packages, so I removed these with this command:</p>

<pre><code>adb -s 091930e9 shell pm uninstall -k Mono.Android.Platform.ApiLevel-23
adb -s 091930e9 shell pm uninstall -k Mono.Android.DebugRuntime
</code></pre>

<p>but this had no effect. This are reinstalled upon starting the app from Visual Studio.</p>

<p>In VS <code>MyProject.Native.Droid properties &gt; Android Options &gt; Packaging</code>, unchecked Use Fast Deployment (debug mode only)
No effect.</p>

<p>In VS <code>MyProject.Native.Droid properties &gt; Android Options &gt; Advanced</code>, verified that x68 was checked.</p>

<p>Looking at the build output as suggested by @hvaughn there is the following warning which is also a warning in the Error List:</p>

<pre><code>Found conflicts between different versions of the same dependent assembly. 
In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
    &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
    &lt;dependentAssembly&gt;&lt;assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /&gt;
    &lt;bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /&gt;&lt;/dependentAssembly&gt;&lt;/assemblyBinding&gt; 
    MyProject.Native.Droid          
    One or more dependent assemblies have version conflicts
</code></pre>

<p>In the Error List it also says:</p>

<pre><code>Do you want to fix these conflicts by adding binding redirrect records in the application configuration file?
</code></pre>

<p>I click Yes. This warning then goes away until the next build and reappears again, so this has no effect.</p>

<p>Then there is this:</p>

<pre><code>:Deployment failed
Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]
   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)
   at Mono.AndroidTools.AndroidDevice.&lt;InstallPackage&gt;c__AnonStoreyD.&lt;&gt;m__0(Task`1 t)
   at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
Deployment failed because of an internal error: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]
InternalError
Build succeeded.
Deploy successfully on Google Nexus 7
</code></pre>

<p>This happens on 2 devices, the Google Nexus 7 and a Samsung SM-T530NU.</p>

<p>The code is from a remote Git Repository.</p>

<p>On the suggestion of @Matt, I created a new Hello World type solution and it installs on the device.</p>

<p>Not sure what to do about this, the suggestions on the web for this error are removing the app, which I did using the <code>adb</code> as shown above. I'm also puzzled by the "Deploy successfully ..." message because it is not on the device.</p>

<p>EDIT</p>

<p>The solution was to do a factory reset. This tells me, that despite the various steps I took to delete the app/package, it was somehow still there.</p>