Xamarin Forms Android app crashes in Release for few devices - xamarin

I have a simple Xamarin Forms app which after upgrading started crashing in Release mode for Pixel 3 emulator, however, its working fine Amazon Fire tab and Xolo Era 3 devices.
I found following error in logcat -
l_3_pie_9_0_-_api_28 Error 13193 DEBUG Abort message:
'java_vm_ext.cc:545] JNI DETECTED ERROR IN APPLICATION:
CallStaticIntMethodV received NULL jclass'
eax 00000000 ebx 00003377 ecx 00003377 edx 00000006
Another thing to notice is when I upgraded Xamarin Forms and Xamarin Essentials it gave me an error that Xamarin.AndroidX.MediaRouter NuGet package is missing. I explicitly installed it and the error went away.
Following are the environment and upgrade details -
Thanks for your help.
Update -
Only external library I am using is Xamarin.GooglePlayServices.Ads
Link to Xamarin Community question

For this error, you could try to reinstall the SDK of Android.

Related

Published Xamarin UWP app crashing on startup when built with Visual Studio 2019 16.10 or higher

I have a working app that has previously been published to the Microsoft Store. I attempted to upgrade my Visual Studio 2019 from a 16.9.10 version to 16.10.x (I've also tried the latest 16.11.2). Everything was working in the debugger after the update for both debug and release builds. However, when I tried to create a package for sideloading on another computer, I discovered the resulting package would crash on startup. In addition, running the appxbundle on my development machine resulted in the same runtime crash.
Further digging showed that the app is crashing in Xamarin.Forms.Forms.Init after throwing an ambiguous match found exception. Printing the stacktrace and capturing with DebugView showed the following:
[15348] Ambiguous match found.
[15348] at System.Reflection.Runtime.Assemblies.RuntimeAssembly.GetRuntimeAssembly(RuntimeAssemblyName) + 0x25
[15348] at System.Reflection.Runtime.General.ReflectionCoreCallbacksImplementation.Load(AssemblyName, Boolean) + 0x1b
[15348] at System.Reflection.Assembly.Load(AssemblyName) + 0x15
[15348] at Xamarin.Forms.Platform.UWP.WindowsBasePlatformServices.GetAssemblies() + 0x1dd
[15348] at Xamarin.Forms.Internals.Registrar.RegisterAll(Type[], InitializationFlags) + 0x6c
[15348] at Xamarin.Forms.Forms.Init(IActivatedEventArgs, IEnumerable`1) + 0x558
Has anyone experienced this? Any suggestions on how to further troubleshoot the problem?
Update: I am able to reproduce the problem in a blank project:
Here are the steps to recreate:
Create a new c# Mobile Project (Xamarin.Forms).
In the shared project, add skiasharp nuget package.
Add new Windows Application Packaging Project to the solution.
Add reference to the UWP project from step 1 to the WAPP. Right-click the WAPP project and publish it for side-loading.
Run the installer to install the app.
When the app is launched it will crash.
If skia-sharp is removed and the installer is rebuilt and run, the app will launch correctly.

Xamarin :: Android - Original attribute defined here

I have Xamarin Android Project with Target Framework v9.
Recently, I updated my Xamarin Forms to latest version. Then, I am getting below error.
I understand from the error message that I need to update 'Target Framework' from Android 9 to Android 10. I did it.
From that moment, whenever I build my android project in 'Release' mode, I get below error. Building project in 'Debug' mode is fine.
May you please help? I need to submit an update to my Android App. :-(
From the comment of "Lucas Zhang - MSFT":
Please enable the
Use incremental Android packaging system (Aapt2)
which is available under Project Properties. It will resolve the error you posted.

Xamarin android hangs on start

Using visual studio 15.7.4
Xamarin 4.10.10.2
Xamarin forms project
compile version api level 26
target android version api level 26
release mode
sdk link assemblies only
using Xamarin forms 3.1.0
Issue:
app starts fine (although long startup time) in debug mode. After installed to 2 different real phones the app splash screen shows on launch but hangs indefinitely
The solution for me was to enable "Zipalign" on the "Signing and aligning APK file(s)" task in my Xamarin Android build definition on Azure Devops (previously VSTS). I got the answer from here
This turned out to be something with the build definition in VSTS, as it worked when built right from Visual Studio

Xamarin crashing between two errors

I try to create a new Xamarin.Forms project for Android and Windows Phone, but I'm getting stucked by two errors.
First of all, I have the following error:
DEP3321: To deploy this application, your deployment target should be running Windows Universal Runtime version 10.0.16299.0 or higher. You currently are running version 10.0.14393.0. Please update your OS, or change your deployment target to a device with the appropriate version.
I've found the solution for this error, on some forums people said that setting the TargetMinVersionPlatform to the current running version of Windows Universal Runtime and setting the TargetVersionPlatform to the expected one should resolve the error. Yes it's true, but now I'm receiving another error:
NU1201 Project App3 is not compatible with uap10.0.14393 (UAP,Version=v10.0.14393) / win10-x86. Project App3 supports: netstandard1.6 (.NETStandard,Version=v1.6)
and after I did some research I found that this problem is resolved by doing backwards all the workarounds that I've did for resolving the first problem.
So, in conclusion I'm being stucked between this two errors. Can anyone help me?
Thank you!
As the .NET Standard document, netstandard 2.0 can be used on UWP version 10.0.16299. It can not be used on UWP version 14393, so you can not change your app target min version to 14393. Currently, Windows phone version is 15254 and you can not run the .net standard 2.0 on windows phone. So the solution would be like # magicandre1981 said on his thread Xamarin.Forms UWP project wont install on windows 10 mobile
Besides, you can also try to create your Xamarin app target version 14393 on the VS 2015 directly.

Multiple errors when creating Xamarin.Forms - Blank Xaml App (Xamarin.Forms Portable) or Android App

I using Windows 10 and am trying to create a Xamarin.Forms - Blank Xaml App (Xamarin.Forms Portable) project for the first time. I have Visual Studio 2015 Enterprise Update 3 installed and have tried uninstalling, reinstalling, and repairing multiple times.
When I create a project, I get the following errors:
"The name 'InitializeComponent' does not exist in the current context"
"Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled" - for App, Droid, UWP, WinPhone, Windows, and iOS
"The XamlCTask task failed unexpectedly..." - for UWP, WinPhone, Windows, and iOS
I tried this on my work computer and home computer and I had the same issues with both.
I have tried updating Xamarin.Forms nuget to the latest version and the created 36 errors with Droid. I also tried going to c:/users/[YOURNAME]/AppData/Local. Delete the Xamarin folder and that did not solve the issue.
I tried creating other Visual Studio projects that did not involve Xamarin and did not have any issues with those. I know the issue is with Xamarin (probably something with Android) itself, but I don't think that there is anything that I am missing from the install. I tried installing it by first installing Visual Studio, then going to Modify and adding Cross Platform. That didn't work, so I uninstalled then downloaded the Xamarin Installer. I had the same issues with both.
I created a blank Android App and that give me the warning - "aapt.exe" exited with code - 1073741849".
A blank app for iPhone does not give any errors or warnings.
Windows Phone does not give any errors or warnings either.
Any ideas of what I should check for so I can get this working?
Here is a picture of the error that I'm getting
Try updating to the latest version of Forms to get rid of the XamlC errors. Assuming you haven't updated, the template is using a modestly old version. As for the aapt error, if you have the N SDK preview installed, removing that should help. Alternatively, make certain that you have up through API 23 installed.

Resources