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

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.

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.

Renamed Application name.
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.
Right click on your Droid project
Select Properties
Got to Application Manifest
Change the Package name
Re-deploy your project
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

Happened to me today, after updating a project from Git and running in Android Emulator. Uninstalling the app from emulator, performing Clean and Rebuild in VS and instaling the application again helped.

Related

Xamarin Android error XA0136 deployment errors

I am trying to deploy my Xamarin.Android application from visual studio to my smartphone which is Huawei P10. During compilation a popup shows up:
After you close the popup an error shows up:
Severity Code Description Project File Line Suppression State
Error XA0136: The 'run-as' command failed with 'run-as: package has corrupt installation: com.companyname.app1'.
The currently installation of the package in corrupt. Please manually uninstall the
package from all the users on device and try again. If that does not work you can disable Fast Deployment.
Fast Deployment can be disabled in the Visual Studio project property pages or edit the project file in a text editor and set the 'EmbedAssembliesIntoApk' MSBuild property to 'true'.
Tools and Devices used:
Visual Studio 2019 version 16.10.1
Xamarin Android
Deploy to Huawei P10 Android 9.0 API 28
Any suggestions pls on what is the problem.
Thanks
UPDATE: If you disable Fast Deployment works fine
According to Xamarin, you have to activate the developer mode for this. In addition, debugging via USB must be approved. You can find the exact statement here on GitHub. If you don't know how to activate the mode, you can find instructions here.
Alternatively, if all these steps did not work you can disable 'Fast development'. Either do this in your project or via Visual Studio.
Fast deployment is known to fail on devices which block run-as, which often includes devices older than Android 5.0. Fast deployment also fails for system applications (android:sharedUserId="android.uid.system") since run-as is also blocked for system applications.
If these solutions work let me know!
I also got this issue when trying to run the app in emulator. But I fixed it by changing to new android emulator

UWP App Won't Start

I have a UWP app. I'm using Visual Studio 2017 15.4.1. The UWP app is a store app and has been deployed to the Microsoft Store. My app was working fine in the store, and it was also working fine when I hit play in Visual Studio. Then recently, an isolated storage issue started occurring so I went in to the app in "Apps & Features" and hit Advanced Options -> Reset. Somehow this has fried my app installation on my machine. Our app no longer shows up as an installed app, and when I try to install the app from the store, I get an error with a code of 0x80073CF9. So, I can't uninstall, or reinstall on my machine. I've tried running sfc /scannow etc. to find out what's wrong, but nothing seems to help.
This wouldn't even worry me too much, but I can't even develop right now because when I try to run the app from Visual Studio, I get this error:
In order to debug this project, you must consume it from a Windows
Store app project that creates a package and is marked as the Startup
Project
I'm getting this error in the output window from the build
4>DEP0700: Registration of the app failed. [0x80073CF9] Another user
has already installed an unpackaged version of this app. The current
user cannot replace this with a packaged version. The conflicting
package is [APP NAME] and it was published
by CN=[Publisher].
What did I do wrong?
You can use Get-appxpackage -allusers *<appname>* | Remove-AppxPackage
The allusers option is important here.
You can also try to manually remove the content of the application cache folder in C:\Users\\AppData\Local\Packages\. If you have one locked file here, the whole deployment will fail.

can only debug not deploy xamarin app with System.Data.SqlClient class used

I'm working on an android app in Xamarin. It will debug in VS2013 community absolutely fine, deploying it to my phone on a usb tether. However I try and deploy a full .pk file set for a website download (I know the user would have to agree to installing 'untrusted apps') after I go through a standard deployment via VS2013, I try a 'dry' installation via download from a site, this doesn't work. It starts fine, and runs up until an sql-command is executed (namely logging in). Not sure how to resolve this one. Any help would be great.
So after some research the answer is simply to turn on 'west' as an option in project properties.
If this fails however this is a bug, and due to be fixed in 4.3 ? (apparently)
more information: http://forums.xamarin.com/discussion/25/problem-inserting-data-in-sql-server-in-release-mode

Visual Studio 2015 Update 2: Registration of the app failed. (0x80073cf6)

I'm experiencing the Registration of the app failed. (0x80073cf6) error.
What I've tried so far:
Delete the package in AppData (I can't find it anymore there, the package family name has been changed to my associated store listing).
Repair Visual Studio
Acquire developer license
Make a new project (that works, for the 1st time, after that same error).
It happens on my phone (950XL, developer unlocked) and on my machine.
I can't debug my app in anyway now.
I'm on Update 2 of VS 2015
In the question, the project-type is not specified, but I think, it can be the same problem, I have...
I have installed VS2015 Update 3 RC and created a Xamarin.Forms shared project from template (without any changes in the project).
Same error for UWP- and Windows 8.1 projects, where Windows Phone 8.1 works in the emulator.
I store my project on a network-drive (what never was a problem with earlier .forms-projects, that have not included UWP- and Windows 8.1-projects).
I have changed the Output path from \bin\debug\ (=sub-directory of the project folder on the network drive) to C:\Temp\Debug and... the error has gone.
So.. it seems as (at least Xamarin-) UWP- and Windows8.1-projects have a problem, when the output-directory points to a network drive.
This is not a final solution for projects on a network-drive, but a workaround to be able to develop until the real problem can be solved (I hope for some changes in VS or a clear advice, what to change regarding the rights of the network drive to solve the problem from MS).
<Properties>
<DisplayName>Name</DisplayName>
<PublisherDisplayName>Other Name</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
In the app manifest file, change the "Name" to anything else. And it'll work.
That is it.

Visual Studio - Registration of the app failed after uninstalling app

I am developing a Universal Windows 10 app and I get an annoying problem every time I try to run project after I uninstall the app from windows start menu. The scenario is:
I run project on local machine - app is running good;
I press Shift+F5 to stop runing;
Go to Windows start menu and uninstall just installed app;
Run app again from Visual Studio;
Get error 1>Error : DEP0700 : Registration of the app failed. An internal error occurred with error 0x80073D05. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues. (0x80073cf6)
NOTE: sometimes Clean Solution + Rebuild Solution helps, but sometimes only system restart solves the problem. Is this an official bug or I am missing something?
I was facing the similar problem, and as per this link
https://social.msdn.microsoft.com/Forums/en-US/566e53ec-2020-4969-9f17-f0a5a916f027/error-dep0700-registration-of-the-app-failed?forum=winappswithcsharp
we need to locate the app`s package in C:\Users\UserName\AppData\Local\Packages and delete it. This error occurs when after installing if the system is not able to delete the complete package from Local.
This is not the official bug in this case.
Please check if your project is build before and then deployed (please see screenshots below) and let me know whether problem remains and what is the version of the Windows platfrom you use.
You can check it using search window and type "winver":

Categories