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!
Related
came across several post but doesn't seem to be able to find a definite answer as to how do one integrate ZeroMQ and Unity without the use of a wrapper/dll.
Wanting to use a Pub/Sub method, so it would be nice if someone is able to assist on this as well.
P/S using VS Code.
Tried copying the entirety of https://github.com/zeromq/netmq/tree/master/src/NetMQ and pasting it into Unity's Asset/Plugin but unable to compile. See Image
Also saw that someone said to use the lib folder in clrzmq and paste it inside netmq, but still unable to compile.
The standard way to use libraries is to import them using nuget. This ensures any other dependencies are included.
I have not used unity3D, but there seem to be a asset to import nuget packages. See this post for more info.
From the NetMQ homepage:
NetMQ is a 100% native C# port of ZeroMQ
This means you do not need clrzmq or any other native library. You still need the dll for NetMQ, but .net dlls are typically easier to include and use than wrappers around native libraries.
Note that NetMQ uses LGPL license, that means you can use the dll for the library. But if you actually include the source code that would mean your whole game would also need to be licensed under LGPL.
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.
I try to create a really simple app containing
Windows Version
Mac Version
Portable Class Library
I would like to put the code (as much as possible) into the Portable Class Library.
Now i simply want to check if a file exists using System.IO.File.Exists() but the File object is not available. I tryed to target different plattforms but i cant get it to work.
What #hvaughan3 said is correct in that the System.IO.File is not available from your PCL and it needs to be implemented within each platform and injected into your PCL. That said the good news is that like many of these common requirements there already is a plugin to do that so you don't need to do it yourself.
Have a look at the following blog post that describes how to use the PCLStorage plugin within your PCL project.
System.IO.File is not available in the PCL code. You will need to implement in platform specific code. You will also need to verify that it exists for each platform. I know it does for Android and iOS, have never tried using it on Mac and Windows. Although from Xamarin's docs it looks like at least Mac does have System.IO.File.
Once you have methods in each platform project, you can reference the platform specific method from your PCL code using Xamarin's Dependency Service.
I'm trying to add the Libspotify SDK to a test solution. However, I got the following error:
Now, I tried following the first answer of this question. However, all I got was:
The package of the library is structured in the following way:
Additionaly, my project is targeted to .NET Framework 4.0
And the configuration is done as follows:
What can I do to add this library?
EDIT:
Also, I found this link where someone explains that it need to be copied manually into the project output directory. I tried putting the .dll there, but I guess I have to modify something else to make it work. Any ideas?
The libspotify.dll you are trying to access is a Win32 C library, not a C# (.NET) assembly. As such, you can only use it through interop.
You don't have to do this yourself (judging by your question I'm assuming you have no previous experience with the techniques involved), you can use a ready-made solution like libspotify.NET.
I am creating a fresh Mono for android application using http://xamarin.com/monoforandroid
I selected Mono for Android Application using Visual C# option.
My Android target version is :
I went to references of the project and tried adding my pre existing dlls (made in .NET 4 Framework)
and I got this error:
The strange stuff is there is no option to change the .NET Framework from project properties. Can you tell me what I am missing?
The problem here is that you're trying to reference a .NET 4 DLL from a project that isn't .NET 4. Mono for Android uses its own profile for .NET, which is very similar to that of Silverlight (but not exactly the same). While it's possible that adding a DLL compiled for a different profile will work, it's very risky as you will probably run into problems at runtime where your app will crash, due to something being missing from the Mono for Android profile.
The best answer right now is to create a Mono for Android class library, link in the appropriate files from the library you want to use, and reference that. This will give you compile-time checking that you're not using anything unsupported by the Mono for Android profile, and help keep you more sane in the long run. I have an old blog post up here that talks about how to link files across projects.
That said, in this case you're in luck because someone else has already done that last part for you! Check out this fork of Json.NET which provides versions for MonoTouch and Mono for Android.
The strange stuff is there is no option to change the .NET Framework from project properties. Can you tell me what I am missing?
It's not particularly strange - that dialog box was written by Microsoft, with its own project types in mind. It sounds like Mono for Android doesn't have the same options available.
I strongly suspect you'll just have to use a version of JSON.NET targeting .NET 3.5.
(Having said that, Mono for Android claims to support "dynamic language features" which sounds like it should be targeting .NET 4. Odd. I suspect the fix is the same though.)