I cannot get my application to launch an Android device from Visual Studio 2015 / Xamarin. It does not start on the device, causing this message:
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.
So, I added the [Activity(MainLauncher = true)] decorator to MainActivity.
I verified that in Build-> Configuration Manager AnyCPU, Build, and Deploy are checked.
Restarting, the same result, did not start on the device and did not produce the same messages.
A stack.site/questions/240374 / ... assumes that the previous application may not have been completely removed, so issuing this command from the adb shell:
adb -s 09103e9 shell pm list packages
shows packets on the device:
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
None of them is an application. Some suggestions on the Internet are to remove Mono, so I deleted them with this command:
adb -s 091930e9 shell pm uninstall -k Mono.Android.Platform.ApiLevel-23 adb -s 091930e9 shell pm uninstall -k Mono.Android.DebugRuntime
but it had no effect. They reinstall when you start the application from Visual Studio.
In VS MyProject.Native.Droid properties > Android Options > Packaging unchecked the use of quick deployment (debug mode only) No effect.
In VS MyProject.Native.Droid properties > Android Options > Advanced verified that x68 has been verified.
Looking at the build output suggested by @hvaughn, the following warning appears, which is also a warning in the error list:
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: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding> MyProject.Native.Droid One or more dependent assemblies have version conflicts
The error list also says:
Do you want to fix these conflicts by adding binding redirrect records in the application configuration file?
Click Yes. This warning then goes to the next build and reappears again, so this is not affected.
Then there is the following:
:Deployment failed Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE] at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) at Mono.AndroidTools.AndroidDevice.<InstallPackage>c__AnonStoreyD.<>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
This happens on two devices: Google Nexus 7 and Samsung SM-T530NU.
The code is from a remote Git repository.
At the suggestion of @Matt, I created a new solution like Hello World and installed it on the device.
Not sure what to do with it, suggestions on the Internet for this error uninstall the application that I used with adb , as shown above. I am also puzzled by the message "Deploy successfully ..." because it is not on the device.
EDIT
The solution was to do a factory reset. This tells me that, despite the various steps that I took to remove the application / package, it was still there.