LibVLCSharp : 'Failed to load required native libraries.' - c#

which exactly native librairies for a WPF Platform do I need from NuGet?
For the moment I installed those (see picture please) but It seems that I miss another one. Have someone an idea?

You have to also install VideoLAN.LibVLC.Windows nuget package and build the solution.
Probably you do not need LibVLCSharp.Forms.* nugets. They contain support for Xamarin.Forms.

Related

How to find out which dependency is missing after DllNotFoundException?

I want to write a small .Net MAUI application which makes use of a C# SDK NuGet Package (implementing Hyperledger Anoncreds).
When running the App on Android (emulator or device) most of the SDK method calls work, but certain calls still throw a DllNotFoundException without any indication of which Dll is actually missing.
After I did some reading on the SDK, I was able to add some .so dependencies to the MAUI project, but apparently there are still some missing.
I already tried reading through the SDK source code and some of the Rust code it wraps to get hunch of what could possibly be missing. But even wading through the cargo.toml files only show me the crates and not any actually libraries.
Android tools like "APK Analyzer" provide a lot of usefull information, but no dependency overview and the "Dependency Walker" tool only analyzes Windows-built binaries which differs from the actual Android environment.
How do I find the missing dependency indicated by the Exception? Is there a tool like "Dependency Walker" for Android APKs?
Edit: Fixed some typos and added more Info.
After a quick google search for an equivalent of ldd on Android I found this:
ndk-depends which should be shipped with Android NDK. I would try and use that on the .so files that you use and include with your project.
EDIT: Here is a link to the manual: ndk-depends
Hope it helps!

SkiaSharp installation causes app to crash onload

I've followed this really helpful blog post (https://blog.xamarin.com/drawing-with-skiasharp/) to install SkiaSharp 1.60.0 to present SVG images in an app. Once the necessary packages are installed, and all compiles, when I launch the app it crashes within the LoadApp method.
Uninstalling all the SkiaSharp nuget packages, then all works fine again, but of course no SVG support! Any pointers?
Ok, think this is the key - I needed to be really specific about the packages to install in each project, and to ensure that the versions are consistent. Posting this here to help others in need!
So the key is to be clear about which specific packages from nuget are needed in which project. The PCL requires SkiaSharp, SkiaSharp.svg (for SVG support) and SkiaSharp.View.Forms (for Xamarin.Forms support). The platform specific projects require all of these and SkiaSharp.View which will install platform specific libraries in each.
It's also important to ensure that the version of each package is consistent between the packages and between projects. The root of the problem I had was that 1.60.3 was installed automatically in the PCL and 1.60.0 in the platform specific projects. This caused the app to crash on load. Downgrading the PCL to 1.60.0 fixed the issue. Probably upgrading all to the latest version would also work as well.

SQLite in WPF application

I'm trying to use a SQLite database file inside my WPF application.
I tried searching for a proper library that wraps the entire SQLite library.
I found the following SQLite library which allows a perfect functionality that suites me.
The problem is building it.
I tried adding it in a Visual Studio as a project and compile it to get a dll file.
That didn't work so much well because of dependencies missing inside the project and sub-projects.
If anyone anticipated or experienced any hard time with this library, I would really use the help and of course appreciate it alot.
Thanks heads up :)
You should install it as a nuget package. Right click on your project -> Manage Nuget Packages -> find SQLite.Net-PCL. You don't need source code for this, only released package and that is exactly what nuget will download for you and add as a dependency.
You can also install the package with Visual Studio's Package Manager Console:
Install-Package SQLite.Net-PCL
If you want to have source code, this library is contained inside a single file, so you can just copy SQLite.cs to your project and it will work.

Xamarin.Auth Android project results in "Cannot find symbol" error for CustomTabs?

I am trying to implement the Xamarin.Auth library in a Xamarin.Forms project. After installing the library in my client project I received a System.NotImplementedException:
System.NotImplementedException:
Portable Bait And Switch is nuget feature, so the package must be installed in all project.
NotImplementedException will indicate that Portable Code from PCL is used and not Platform Specific implementation.
Please check whether platform specific Assembly is properly installed.
Therefore, I installed the library in the Droid project as well. Once I did this, I started getting "Cannot find symbol" errors related to the CustomTabs control:
error: cannot find symbol
extends android.support.customtabs.CustomTabsCallback
symbol: class CustomTabsCallback
location: package android.support.customtabs Kpa.Mko.Mobile.Client.Droid
H:\...\obj\Debug\android\src\android\support\customtabs\CustomTabsClient_CustomTabsCallbackImpl.java
There are 6 of these errors in all, each one related to CustomTabs in some way.
We're using:
Xamarin.Auth 1.3.2.5 Xamarin.Forms 2.3.3.193
Xamarin.Android.Support.v7.AppCompat 25.1.1
Xamarin.Android.Support.v7.CardView 25.1.1
Xamarin.Android.Support.v7.MediaRouter 25.1.1
Xamarin.Android.Support.v7.RecyclerView 25.1.1
I've done some research on this problem in the Xamarin forums, here on Stack Overflow, and of course Google but none of the suggested fixes I found is solving my problem. I am completely confused as to what could be going on here. Am I missing the obvious?
Thanks!
Make sure you have the Xamarin.Android.Support.CustomTabs NuGet package installed. This is not, by default, included in the pre-packaged Xamarin.Android.Support packages that are loaded with the Android project template.
Nuget package tuning can be problematic. I had numerous problems since I added Xamarin.Forms support. Try nuking all bin/ and obj/ folders, if not update SDK and then again nuke everything...
Xamarin.Auth nuget has dependencies and it should pull other stuff in.
Samples extracted from the repo:
https://github.com/moljac/Xamarin.Auth.Samples.NugetReferences

Do we need to restrict the depencencies in .NET Core libraries?

I have a library written in full .NET and I am porting it to .NET Core. I intend to make it target the .netstandard1.1 (in order to be also compatible with .NET45).
When I create the project with visual studio, it automatically depends on the NETStandard.Library nuget package.
My library only needs two packages:
System.Runtime
System.Runtime.InteropServices
Two questions :
Do I need to restrict my project dependencies to only these two packages? Rephrased: may be nuget (or visual studio or another magic stuff) manage to restrict on its own to only the needed packages and not the full NETStandard.Library?
If the answer to the first question is no, is it a good idea to perform that restriction?
Thanks in advance.
(Sorry for my english, I am not a native speaker)
There are some aspects in your question...
The netstandard1.1 framework choice will limit your available API surface in the editor (here VS Code) to what is available that version. Just tested with File.OpenRead on VS Code for netstandard1.1 (not available) and netstandard1.6 (available).
The NETStandard.Library dependency (version 1.6 is good for both cases) is a package dependency. Once the assembly is compiled, the assembly itself will declare external assemblies (aka referenced assemblies) which were actually used (e.g. System.Runtime and System.Linq) and not all assemblies found in the NETStandard.Library meta package.
As long as you are not packaging it up for NuGet, assembly reference restrictions are anyway done for you. NuGet packaging however would refer to the NETStandard.Library package
If you use NuGet and that reduction is important to you, I guess the correct term is NuGet dependency trimming, a manual process explained here (short version: copy all references from the meta package and remove all you do not use).
I am not sure if it's a VS bug, however seems like VS doesn't like building a library and not having a NETStandard.Library package included :) So, no.
Unless you use Visual Studio Code or Notepad etc. this will slow down your development, since VS will prevent you from building the project etc. So, no again.
The bottom line.
Premature optimization might cause more issues than benefit. Port your library first, and only then check if you need to optimize it.

Categories

Resources