Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application could not be started

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:

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 decorator [Activity(MainLauncher = true)] to the MainActivity.

I checked that in Build-> Configuration Manager, AnyCPU, Build, and Deploy are checked.

Restarted, same result, did not start on device and gives same messages.

A post on StackOverflow suggests that the previous app may not have been entirely removed, so issuing this command from the adb shell:

adb -s 09103e9 shell pm list packages 

shows the packages 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 these are the application. Some suggestions on the web are to remove the Mono packages, so I removed these 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 this had no effect. This are reinstalled upon starting the app from Visual Studio.

In VS MyProject.Native.Droid properties > Android Options > Packaging, unchecked Use Fast Deployment (debug mode only) No effect.

In VS MyProject.Native.Droid properties > Android Options > Advanced, verified that x68 was checked.

Looking at the build output as suggested by @hvaughn there is the following warning 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

In the Error List it also says:

Do you want to fix these conflicts by adding binding redirrect records in the application configuration file?

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

Then there is this:

: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 2 devices, the Google Nexus 7 and a Samsung SM-T530NU.

The code is from a remote Git Repository.

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

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

EDIT

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.

like image 720
Al Lelopath Avatar asked Apr 29 '16 20:04

Al Lelopath


People also ask

How do you fix application Cannot be started Contact the application vendor?

Contact the application vendor." What should I do? This error is typically due to a corrupted ClickOnce (a Microsoft installation technology) cache. Try deleting it and reinstalling AudioNote: To delete your ClickOnce cache (you may wish to make a backup copy first) delete the “\apps\2.0\” folder.

What is a .NET Framework error?

Error causes This error typically indicates one of the following conditions: A . NET Framework installation on your system has become corrupted. The version of . NET Framework needed by your application cannot be detected.


3 Answers

You can find your package name by clicking your android project and then open properties, then select android manifest. Find the old app with the same package name remove it and everything should work.

It should look like this:packagename

like image 58
Sanne Avatar answered Nov 15 '22 07:11

Sanne


INSTALL_FAILED_UPDATE_INCOMPATIBLE means your app is already deployed on the device with an old version of Xamarin.

The deployment process removed your old app's icon but not the old app. So you now need to remove your app without having its icon before deploying again. This is a very old limitation of Xamarin deployment on Android. To do that:

  • Go to settings / applications
  • Find you app, it's name will be someting like com.company, not the app's name
  • Delete it
  • Redeploy
like image 37
Softlion Avatar answered Nov 15 '22 07:11

Softlion


Try to generate the apk in release project configuration using an emulator and then install that apk file manually to the device and check if it shows the update screen or the new installation screen. If it shows the update screen then the application might be in your phone else there must be a problem in the solution. You can also try debugging the application using the Xamarin studio with the same sln file to check if there is a problem in VS2015.

like image 33
Akash Amin Avatar answered Nov 15 '22 05:11

Akash Amin