Xamarin Android error XA0136 deployment errors - c#

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

Related

Xamarin Hot Restart Not Working on Windows, Visual Studio 16.9.2

I am trying to do physical testing for an iOS app using Xamarin Forms following this tutorial: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/deploy-test/hot-restart, but I am running into a problem when trying to debug to an iPhone or iPad. There have been no issues doing physical testing on Android through usb or simulation testing through MacInCloud, but I run into this error when deploying to iOS through usb for testing:
"Xamarin.iOS does not support running or debugging the previous built version of your project. Please ensure your solution builds before running or debugging it."
My Apple Developer Account is successfully linked to Visual Studio and I have iTunes installed, so I don't know what the issue could be relating to. I have tried all the common fixes, such as cleaning and rebuilding the file, restarting visual studio, and trying multiple devices.
I appreciate any help I can get.

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.).

Unable to deploy Xamarin app on physical iOS device in JetBrains Rider

I decided that I want to work on my Xamarin apps in Rider, IDE from JetBrains. I tried to do that yesterday and the problem was, I can't for some reason deploy my app on physical iOS device (iPad 4). In Visual Studio 19 for Mac it works fine, so my provisioning is fine.
When I try to run app with iOS default config, it offers me various deployment targets, all of which are simulators. But if I go to edit the configuration, I can select connected device and then select my iPad. Though, when I go to run the app again, I am once more greeted with list of simulators.
Please, help me figure out what the issue is, brief googling did not help.
I fixed it by switching from Debug configuration to Debug|Iphone configuration, then it showed my ipad as deployment target. Hope it helps someone

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.

Android application does not works: "The xx.xx application (xx.xx process) stopped unexpectedly. Try again

Well, I'm getting started in applications android development, as I'm familiar with C#.NET(and I love it), I decided to use the fantastic MonoDroid project. I downloaed and installed,worked fine until now. I created hello world application, using MonoForAndroid_API_8 emulator device, worked fine.
then I copied *.apk files and installed in my tablet with android OS 2.2, but when I run my application,I get the following error:
The xx.xx application (xx.xx process) stopped unexpectedly. Try again.
how to fix this? Any help is very appreciated. Thanks in advance.
You can find information here about how to view the Android logs.
I'll take a guess at what your problem is though, without having seen the logs. Are you using the full version of Mono for Android or the evaluation? The eval doesn't support deploying to an actual device.
If you are on the full version, is the APK from a debug build or release? Debug builds are made to use a shared runtime to make deployments quicker, but it means that the APK doesn't contain everything the app needs to run. Release builds don't use the shared runtime, so the Mono runtime is bundled with the APK.

Categories