I have been trying to make the nuget package of Vosk (https://alphacephei.com/vosk/install) work for a Xamarin app, but I get a System.DllNotFoundException when I initialize a Model, which I presume to mean that there is no definition of it. However it works perfectly fine on a normal C# application.
I have no idea of how to compile the library so it works with Xamarin. Are there any general things I should try? If it works only for Android that is fine.
Related
I am trying to include Judopay in my project, and I was able to add it to Android and iOS, but not to the Xamarin forms project. There is no NuGet to be included and I can't seem to add the component reference. Any idea on how can I add it? I cannot use any of these:
using JudoDotNetXamarin;
using JudoPayDotNet.Enums;
using JudoPayDotNet.Models;
Again, they only work on iOS or Android, but not Xam forms.
That is because they only provide platform implementations. You will need to tell your Forms app which implementation to use at what time.
The correct way to go about this is with some form of IoC, using dependency injection or service location. Luckily Xamarin Forms has this integrated:
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/dependency-service/introduction/
Using the references from the Android or iOS projects in your shared code will likely not work completely or break things. Maybe not immediately but surely later on. (Except when there really is no platform-specific functionality, then you might get away with this.)
How do i make sure my app can run on android devices below Lollipop( version 4.03 to 4.42). I watched a xamarin university video that says xamarin forms supports android version 4.03(ice-cream sandwich) and upwards. I also read about runtime checks and feel like this might be the answer to my problem, but how can i write runtime checks for android when basically all my ui and logic is contained in the PCL project?
The first thing to do is ensure you are using the Android AppCompat library. I think new projects use this by default now. If you have an older project that doesn't follow these instructions to update. This will allow your app including any Material Design look and feel to run on older versions of Android.
If you do things differently based on Android version, put the code for this in the Android project and use dependency service to call it.
Like this:
if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
{
// level specific code here
}
I am trying to figure out how to run NewRelic mobile on xamarin forms android application. I found this repository. It is pretty old, but i tried o put latest .jar file and native library builds just fine. After i connect compiled dll to client project, i cant find a way to initialize newrelic, b/c there is no NewRelicHelper class, though it was declared in binidng metadata. Can you help and tell me how to find class that i need and initialize newrelic? Here is repo where you can reproduce issue.
I got it at least a step further, but it is still not working 100%
If you right click the csproj in visual studio and go to properties, in the Application Tab change the Android Class Parser to "class-parse" and the NewRelicHelper will now be in the dll, but the withApplicationToken method is not there.
I have a solution with 4 projects 2 PCL's, a Droid Library and a droid App. When I reference the Droid Library from my Droid Application at compile I'm getting:
Error XA5211: Embedded wear app package name differs from handheld app package name.
In both Xamarin Studio and Visual Studio.
Thing is it's not a wear app package nor do I have a handheld app package. Im just trying to reference a Library I created from an android App I created. I cant find any settings in either the csproj file the sln or the IDE that have changed that made my driod library into a wearable library (Im sure I changed something just dont know what) Its here somewhere just no idea were or what I'm looking for besides scanning for the word wear which doesn't seem to show up anywhere. I looked back through my change history and I dont see where it got messed up at.
Until last week everything was fine. Then I started trying to get the latest release of Xamarin.Forms to allow my code to compile. I changed a number of settings over a week of debugging that issue and finally got everything to work again by setting my target Platform to 6.0 and downloading the latest Android SDK.
The Libraries I'm attempting to reference that cause the issue I have on GitHub # https://github.com/Indiponics/IndiXam-Lib in case anyone cares to look at the csproj file etc.
The solution is easy. Open the .csproj file of your Android app and find the project reference you need to work. It might look like this:
<ProjectReference Include="..\MyWearApp\MyWearApp.csproj">
<Project>{D80E1FEF-653B-448C-B2AA-609C74E88340}</Project>
<Name>MyWearApp</Name>
<IsAppExtension>True</IsAppExtension>
</ProjectReference>
The problem is with the extension part. Simply remove the IsAppExtension line and any other than Project and Name. It should work now.
I think we lost an entire man-week on this issue!
https://developer.xamarin.com/guides/android/wear/working-with/packaging/
I am not sure if this is a known bug or some conflict with jQuery Mobile within the Tool for Cordova project but when I use jQuery Mobile inside mine project the layout did not rendered correctly.
For example, start with a blank project. I then added both jQuery 2.1.3 and jQuery Mobile 1.4.5 from NuGet. Then inside the index.html, I have added a text input element. It is pretty simple and nothing is complicated. Then trying to run the project on both simulators and real devices would yield the result that the text input element did not appear at all, even though it resided inside the DOM. Further investigation provided the same result like this question: Tools for Apache Cordova: JQueryMobile wraps input tags inside a head tag?. This did not happened when I targeted the app with Android or iOS. Everything would rendered correctly in those two platforms.
I suspect that there are some conflicts when Visual Studio built the application and injected WinJS as well as jQuery Mobile. I have searched a lot of place and there are no mentions of incompatibility between them.
After trying everything, I gone back to the basic. I started installing Cordova CLI and tested to see if this problem would be there. To my surprise, the Windows 8.1 and WP 8.1 projects from the Cordova CLI build are working perfectly fine. Everything is rendered correctly, although there was an issue with jQuery Mobile changePage().
If this is actually a bug in pre-released software, then I hope in the final release, everything should work correctly. In the meantime, anyone would like to try suggesting me a workaround for this problem. I know there are at least me and the other guy from the question that I have linked above that had issue like this.
Thanks.
Update my finding: The problem is with the library winstore-jscompat.js. Apparently, even with the new CTP 3.1, the file is not the recent one from GitHub. I downloaded the new version from GitHub, replaced it with the old one, and everything works perfectly now.
The GitHub is from here: https://github.com/MSOpenTech/winstore-jscompat.