I'm building a new Xamarin mobile app using Xamarin Forms 5.0 and tried to install Auth0.OidcClient.iOS and Auth0.OidcClient.Android as suggested by the instructions on Auth0 website here: https://auth0.com/docs/quickstart/native/xamarin
I get an error that tells me that these packages are NOT compatible with .NET Standard 2.0 -- see below:
What packages am I supposed to use with a new Xamarin Forms app?
P.S. I'm on Visual Studio 2022 17.1.0 and the app is a Xamarin Forms app with the following version numbers in the project file:
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2196" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
as the name suggests Auth0.OidcClient.iOS should be installed in your iOS project and Auth0.OidcClient.Android should be installed in your Android project. You are apparently trying to install them in the shared Forms project
Related
I modified the below code for Shared Project,
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
</PropertyGroup>
No, it does not. Plan to migrate to Maui, which targets WinUI 3 (Windows App SDK) instead of UWP. UWP is deprecated for new .NET projects.
I started a new Xamarin project and installed the MvvmCross.Forms.StarterPack 5.4 NuGet. All of the projects were changed to support the MvvmCross framework except for the UWP project. What do I need to add to the UWP project so that it will build and run?
MvvmCross has a playground project setup for UWP, https://github.com/MvvmCross/MvvmCross/tree/develop/TestProjects/Playground/Playground.Forms.Uwp. Maybe you can follow it to set it up manually.
In my project, I am using the Microsoft.EntityFrameworkCore.SQLite package from NuGet. But for Android 7+, the app crashes with unauthorized access to "/system/lib64/libsqlite.so".
This is because Android 7 doesn't allow native libraries other than the ones in their NDK (as far as I understood). Also see this issue: https://github.com/aspnet/EntityFramework/issues/7777.
So, I researched the internet for about 2 days now and unsuccessfully tried a bunch of things to get EFCore to work on Android 7. One of them was to update to the preview version v2.0.0-preview1-final. But this resulted in other problems like the following where the app compiled, but crashed while deploying/starting on the emulator:
06-21 09:58:18.970 D/Mono ( 3632): Assembly Loader probing location: 'System.Runtime.CompilerServices.Unsafe'.
06-21 09:58:18.970 F/monodroid-assembly( 3632): Could not load assembly 'System.Runtime.CompilerServices.Unsafe' during startup registration.
06-21 09:58:18.970 F/monodroid-assembly( 3632): This might be due to an invalid debug installation.
I then tried to add the 'System.Runtime.CompilerServices.Unsafe' NuGet package manually to my project, but it didnt fix the problem.
I messed around a lot, trying different build parameters and such and actually got the app running with the preview package of EFCore on an Android 7 emulator. However, after a project clean and rebuild, the error showed up again.
Any help on how to get EFCore Sqlite to work on Android 7?
I am using Visual Studio 2017 with Xamarin.Android 7.3.1.2
I created an example project in order to reproduce the issue: https://github.com/tipa/EFCoreSample - Basically just started with the basic Android template from VS and added the Nuget package
I know this was asked more than two months ago and you've probably found the solution, but I've wanted to post how we've managed to get around this issue.
We are developing a Xamarin.Forms application with EntityFrameworkCore and SQLite. Due to project and company policies, we are restricted to using .NetStandard 1.6 (we migrated our PCL projects from .NetFramework to .NetStandard in order to integrate EntityFrameworkCore).
After this issue started happening to us, we managed to fix this by doing the following:
Updating "Microsoft.EntityFrameworkCore" and "Microsoft.EntityFrameworkCore.SQLite" from version "1.1.1" to "2.0.0-preview1-final" (this is the latest version that works with .NetStandard 1.6) in the DAL project (we have a separate PCL project that contains the Context, UoW, Repositories and Models)
Updating just "Microsoft.Data.Sqlite" (this automatically updates the needed dependencies) from version "1.1.1" to "2.0.0-preview1-final" in the main Xamarin.Forms Android project
EntityFrameworkCore versions 2.x.x use the Android 7+ "approved" way of accessing the "libsqlite.so" file, while versions 1.x.x do not.
Hope this is of help to anyone who might use similar packages that we had.
I had the same issue and I found a solution to this problem.
I'm using Xamarin.Forms applications with .Net Standard 2.0 libs and using EFCore with SQLite. All you have to do is edit your Android csproj and add this after the last PropertyGroup tag:
<PropertyGroup>
<NoWarn>$(NoWarn);NU1605</NoWarn>
</PropertyGroup>
And then add the reference for System.Runtime.CompilerServices.Unsafe in csproj:
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.3.0" />
Clean and Rebuild your Android Project.
I found the answer to the problem here: https://developercommunity.visualstudio.com/content/problem/152947/xamarin-android-run-error-could-not-load-assembly.html
As I was already developing Android apps, JDK 8 and Android SDK are already installed in my machine. But it is in a custom location, not the default one. Using the default Visual Studio installer, I could not install Xamarin without installing JDK and Android SDK again in the default location. Then I tried to install Xamarin.Android manually according to instructions in this page-
https://developer.xamarin.com/guides/android/getting_started/installation/windows/manual_installation/
This page instructed to download and install Xamarin.Android from store. But Xamarin store requires an account, which I assume to manage the paid subscriptions. Given Xamarin is free now, how should I proceed to install Xamarin.Android manually and reuse already installed Android components?
You can contact us at contact#xamarin.com and we will send you the latest download links to the Xamarin.VisualStudio installer which includes both Xamarin.Android and Xamarin.iOS (there is no separate installer per platform for Windows).
The Xamarin.VisualStudio installer does not attempt to install the JDK or Android SDK, so this sounds like what you need.
I'm creating an Android app using Xamarin with Visual Studio. I want to install the Windows Azure Storage nuget package but it's failing to install because the System.Diagnostics.Tools package it depends on doesn't target the MonoAndroid framework. Is there a way around this? Could there be something wrong with my configuration?
Make sure your are adding Nuget package 'WindowsAzure.Storage.7.0.0' as older versions did not support PCL Profile 111 and thus Xamarin.
Package.config:
<package id="WindowsAzure.Storage" version="7.0.0" targetFramework="monoandroid51" />
Microsoft Azure Storage SDK for .NET (7.0.0)
Target Frameworks
Portable Class Library Profile 111: Storage Client Libraries are available to support building PCL Profile 111 applications, as well as for Xamarin application development. This support is currently in preview.