Xamarin deploying not working with Android - c#

I've set up a new Xamarin.Forms Project. I want to build and deploy it to an emulator or an Android device, but it is not working. In the Outputwindow of Visual Studio, the following error is displayed:
The application could not be started. Ensure that the application has
been installed to the target device and has a launchable activity
(MainLauncher = true).
Update:
If I look in the build logs i can find following:
2>Mono.AndroidTools.InstallFailedException: Unexpected install output:
Error: Could not access the Package Manager. Is the system running?
2> bei
Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String
output, String packageName)
2> bei
Mono.AndroidTools.AndroidDevice.c__AnonStoreyD.<>m__0(Task`1
t)
2> bei
System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
2> bei System.Threading.Tasks.Task.Execute()
2>Deployment failed because of an internal error: Unexpected install
output: Error: Could not access the Package Manager. Is the system
running?

You need to first set the Android project as the Startup Project.
Right click the Android Project and select Set as StartUp project.
Ensure that you have checked the Build and Deploy checkboxes.
You can right click the Solution and select Configuration Manager.
Also, please ensure that the Emulator is already running.
You need to wait for the emulator to full start - takes about a few minutes. Once it is fully started (UI on the emulator will change), it should work.
You will need to restart the app after the emulator is running and choose the running emulator (when prompted).

This can be caused by a few things. When ever I get this, I switch the Output window drop-down to Build. Usually that shows an INCOMPATIBLE error of some kind. That usually means the app install on the device/emulator got corrupted/messed up in some way. The app probably will not even show up on the app dashboard area but if you go into Settings -> App (or App Manager) -> then look for the app's App ID (NOT the app's name). When you find it, uninstall it and try again.
Another common cause of the error for me is that the correct architecture is not selected in the Android project properties. This usually is the case when trying to run on the Xamarin Android Player. To fix that, right-click the Xamarin Android project -> Properties -> Android Options -> Advanced -> select x86

This means you are deploying to a device/emulator with an app that doesn't contain the appropriate architecture.
So let's make sure you have the following, first go to your android project options and make sure you have these checked:
Then you might also need to click Advanced on this screen and check the appropriate architectures:

I keep getting this error too with an Android emulator running Android 4.4.2 (though I am not using Xamarin.Forms) and it only happens with that emulator. I resolve it as follows:
1) In the command console (cmd.exe) type the following commands to restart ADB:
adb kill-server
adb start-server
2) In your project choose the Build menu and choose Clean Solution.
3) Try deploying the app again.
You might have to repeat the above twice sometimes (if it doesn't work its a good idea to shut down the emulator and then restart ADB then try deploy again).

In my case application icon needs to be set on Android Manifest.

Related

App crashes after installing a Xamarin-Forms app

I have 3 self-written apps on my phone. 2 written with Xamarin.Android and one written with Xamarin.Forms. But there is a big problem. It always work only 2 or 1 app depending on which of the 3 apps was installed last. If one of the two Xamarin.Android apps was installed last, then both Android apps work. The Forms App, however, crashes immediately. Same the other way around. If the Forms app was installed last, it works fine. The two Android apps crash immediately.
Is there any reason for that? Are the frameworks not compatible?
I had the same problem trying to install the apk from Debug folder.
Steps that worked for me:
- Disable "Use Shared Runtime"
- In Advanced Settings, Select supported architecture
Check the screenshot if not clear
If you are deploying a debug apk into the same device, with different Runtimes, when the apk is installed will remove the previous / override. So, you will need to: disable Shared Runtime, or make sure the dependencies are all the same in all the applications
If you are using visual studio then Check "Application output" with release on device.
In Application Output you can see if any exception is causing problem..

Cannot install UWP app package in release mode on windows 10 iot core

I have an application that i want publish it using application packages file and install manually i don`t want to use Microsoft Store for publishing my app. I create my application package files as you can see below
After that when I want to install my application package from Windows 10 iot Device Portal I didn`t got any error but when application run it stucks on splash screen page.
Generally, if you encountered an app hung up when running, you can follow the below steps to troubleshoot.
Try to deploy/debug the app from Visual Studio;
Try to deploy/debug with a blank app;
Set break points or trace the event log to check if there is some exception or what code causes the hung up.
When debugging with Visual Studio, checked the Compile with .Net Native tool chain in Debug setting, by default, when the app runs in debug mode, it will not use Compile with .Net Native tool chain. Please see this blog.
If possible, you can share the code of your splash page.

Unable to activate Windows Store app. The activation request failed with error 'Access is denied'

UWP program that used to work fine does not want to start. When starting the app from Visual Studio 2017 the error message is:
Unable to activate Windows Store app '{guid-name}'. The activation request failed with error 'Access is denied'.
Windows Event Viewer displays the following error:
Activation for {guid-name} failed. Error code: Access is denied.. Activation phase: COM ActivateExtension
The app deploys successfully, but then trying to start it (with or without debugging) it fails. When trying to start from Start menu, nothing happens when I click the app icon, but when trying to start from Visual Studio it produces an error message box. How to find out what is actually wrong?
I have tried the following:
Rebooting computer
Clean solution
Uninstall the deployed app
Delete bin folder
Compile with .NET Native toolchain
The solution is on C: drive
Change package name
Change to release profile and back to debug
When I try to create a new UWP app, it works fine, so this is most likely solution-specific error, not something wrong in the computer itself.
Usually this happens when there is an App with the same GUID as the one you are trying to Install/Debug. I would try to find the existing App, uninstall it, and try to deploy/debug again.
I had the same problem when creating a blank Xamarin.Forms app targeting UWP. The solution was to create an exception for my app in F-Sscure which would otherwise block it.
I had a similar error message to this, but my error was that a Nuget package had a different package version to my App.
"App" had dependency "B" version .14
Dependency "A" had dependency "B" version .13
i don't think this will solve this particular issue but it solved mine and i couldn't find solution to this anywhere.

Xamarin IOS app fails

New to using Xamarin with Visual Studio 2015. I have set up what I think is a very simple IOS app where it counts the number of button clicks.. I am using a MacInCloud machine as my build host. I am using an IPhone simulator.
When I build and deploy, the application sort of flashes for a moment and then goes away. It does this repeatedly. In the output window I get the following error
Launching 'NewApp.iOS' on 'iPhone 5 iOS 9.0'...
The app has been terminated.
Launch failed. The app 'NewApp.iOS' could not be launched on 'iPhone 5 iOS 9.0'. Error: An error occurred while executing MTouch. Please check the logs for more details.
The app has been terminated.
If anybody can offer me some direction with this it would be greatly appreciated.
--Jason
It has been a while since I had this specific issue. Try cleaning your project. Possibly go as far as deleting the bin/debug folder contents in your IOS project. Make sure your architecture is set to 86_64 under the build / advance tab. Make sure your MAC build client is up to date, Make sure you are building for debug. close VS and reopen. Also do a cold restart on your mac and windows machines. Don't "Reopen windows" either.

signtool.exe not found c# and cannot publish because project failed to build

I have programed one c# windows application and i am trying to run that on my clients(customer's) machine.
First>>>I tried to publish that application.
Whie publshing it is giving me two errors
1.cannot publish because project failed to build
2.signingtool.exe not found.
Event though searching on web , i did not get appropriate solution for this problem.
Then i tried to make exe of the application by releasing the application in x86 mode.
When i double clicks on application file(exe)...it gets opened and gives me error
1.microsoft.ace.oledb.12.0' provider is not registered on the local machine
After this error i installed the setup for AccessDatabaseEngine.
Although installing this...it gives me error...
what should i do for these errors???
Help me out for both the problems of same case...
i have refered this post
ClickOnce - Cannot publish because a project failed to build
and tried to build and publish the project via menus on the top....but still the problem is same...
Don't worry, I had this problem.
It's quite an easy process:
Open Programs and Features
Select Microsoft Visual Studio
Click Change
Select Modify if prompted (depends on your VS version)
Choose ClickOnce publishing tools and install them
Also, I found a bunch of cool stuff that you can install from there.

Categories

Resources