Xamarin emulator deploy failed - c#

I'm building a Xamarin app using visual studio 2017,I added a button and ran my application just for testing the emulator , I've tried all the emulators and created my own one , they all gave me the same error , Nothing appears on the error list , but a message popup says Deploy failed ,also I've tried to debug on my mobile with usb and the same error appeared, I've tried so many solutions ,nothings changed , any help please?
Here's a screenshot of the output window
Thanks.

check if you don't have multiple versions of the java jdk, delete Bin ond Obj folder of the android solution clean and build again, also try to update to vs 15.6.6

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

Xamarin.Forms apk file wont do anything, in live debugging it works perfectly

Ive wanted to share my app to friends for testing-purposes. While everything worked fine while debugging, the app wont do anything once installed as pure apk. There are no error messages, the app just freezes before even the GUI appears.
What I've tried:
I built the xamarin.forms project, archived the android project of it, clicked distribute -> Ad Hoc. Then I created a signature and copied the produced apk to my phone.
I also enabled debugging in the release solution, expecting an error that only appears there, but this also wasn't the case.
How do I fix this? What am I doing wrong?
I am not exactly sure what helped, but I used the clean uninstall from adb, unclicked all permissions and I unchecked "Use Shared Runtime".

Why does my Android App freeze and can't deploy?

I am using a MAC Book Pro and I wrote my Android App in Visual Studio using Xamarin in Parallels (virtual machine).
When starting the app, it builds, but then the "mobile screen" freezes and when I stop the application then I get two Error Messages:
-) Error ADB0010: Unexpected install output: cmd: Can't find service: package
-) Error ADB0000: Deployment failed
Mono.AndroidTools.InstallFailedException: Unexpected install output: cmd: Can't find service: package
How can I fix this?
The App looks like this when I've started it
Try the below suggestions:
Make sure you have the latest Android Emulator version running.
Try a different Android version If you're using Visual Studio 2019 like me you have to go with Android 8.1 Oreo or higher.
3.Read this: StackOverflow Question
It normally caused by that the android emulator does not run well. Please check that you have installed all the emulator package.
After that, when I get this issue, I always stop the android device, in the device manager, edit to change the disk.dataPartition.size value to ‘5000M’(You could set the value according to your device.).

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":

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

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.

Categories