I'm using an native lib for android via Java Bindings Library Project. All goes fine,except one method(and i don't understand why,maybe he's incorrect ported from java to C#).
So the main idea,to make an workaround via Callable Wrapper.
I have implemented Android project in native mode. In this project i also implemented java class(where i'm using this unlucky method) and what i need,just to know how to generate automatically Wrapper and how to add/use into my Mono project?
Or can i make an .jar lib on this native Android project and via bindings library add to my Xamarin.Android project?
PS Sorry for my eng.
Possible solution is to add new java class to OpenCV project. That class should contain methods you want to use ( e.g. to wrap FindContours()). Rebuild project and resulting JAR use in binding project in MonoDevelop/VS solution.
That way you'll call wrapped FindContours() method and it will return expected results :) .
Related
Is there a way to create Java class in VS Code similar to Eclipse New Java Class Wizard?
I would like VS Code to add package and class declarations automatically like Eclipse does.
Couldn't find relevant info in the docs and relevant functionality in plugins.
I faced a similar issue, coming from Eclipse/IDEA background, you can find it difficult to not have a feature in your java IDE to create a new classes, packages etc.
You can use the below VSCode extension : https://github.com/jiangdequan/vscode-java-saber
It is a very handy extension.It provides support/wizard for:
New: Java files(annotation/class/interface/enum/package/JSP/HTML)
Generate Getters and Setters
Copy Qualified Name
Sort Project By Name
Run Maven Goals
Generate Docs
You can try this extension.Search for vscode-java-saber in the extension search and install it.
I get tons of error regarding SpongyCastle's auto-generated .cs files after importing them, even though Xamarin generated them.
The Java library that I created needs the dependency, and I imported it into the Jars folder together with my Java library.
How to fix this?
If it is a Java library that is referenced by your Java library and you do not need to access it via C# user code, then you do not need to create a C# bindings for it.
Flag that .jar/.aar with a build type of:
EmbeddedReferenceJar : Use this to compile against and include it in your binding library.
or
ReferenceJar : Use this to compile against but not include it in your binding library. You will need to supply it in your final APK in another way.
Re: Build Actions
I need to be able to add an existing Node js project as a maven dependency in a java project to be able to call functions from the node js project. I researched quiet a bit but am unable to find a way to do this.
I do not want to embed js in java, rather just import the libraries. Can anybody suggest a way ?
You could create a new Kotlin mutlti-platform project which takes a dependency on your node-js package. Then you could create a wrapper kotlin function which calls your node-js function. You can then use this Kotlin package as a dependency in your Java package. Here is more information regarding Kotlin multi-platform: https://kotlinlang.org/docs/multiplatform-library.html
I had to include some bittorrent java library to my Android project. My workspace: Android Studio 1.0.2 (osx) and jdk8. I've connected its maven-repository (ttorrent:1.4) with Gradle and after starting using main classes and features i've got an error:
java.lang.NoSuchMethodError: No static method encodeHex([BZ)[C in class Lorg/apache/commons/codec/binary/Hex; or its super classes (declaration of 'org.apache.commons.codec.binary.Hex' appears in /system/framework/ext.jar).
I went to library's code and find out that it's using org.apache.commons.codec from where ttorrent is importing encodeHex and calling it. Looks like binaryHex method is gone! Or it never been. But I went to commons.codec's code and found binaryHex in its place and with arguments that I was looking for. How come? Why? My Android Studio found it. But java runtime not.
In fact, the decision was more difficult than I thought. Let's start with the fact that I came across an article by Dieser Beitrag'a, from which it is clear that not one I had similar problems. The whole thing turned out that within the Android operating system already has some libraries that have a higher priority use, rather than loaded with dependencies along with the application. Among them there and my org.apache.commons.codec.
Yes, such things.
To solve the problem in two ways, either you need to pump source code library and using some tool to rename the project (i.e. org.apache.commons.codec to org.apache.commons.codec.android), collected it to a .jar file, include .jar in a project and at code use imports of the necessary classes only "our" library, or just get the required class to your project and do not pull a megabytes of unneeded code. However, I did just that.
Thanks for help!
I have working project where I use JNI to call methods from C library.
My project's structure:
And code which load library:
static {
System.loadLibrary("RemoveBackground");
}
It works good. But until I try to integrate this functionality in other project. I copied jni and libs folders. Also all three classes without RemoveBackgroundActivity (test activity). And when I compiled this project I have an exeption:
1663-1663/com.example.Activities E/dalvikvm﹕ The lib may be ARM... trying to load it [/data/data/com.example.Activities/lib/libRemoveBackground.so] using houdini
1663-1663/com.example.Activities E/dalvikvm﹕ dvmHoudiniDlopen returns 0x9833cf40 with bool=1
Do you know how to solve the problem or some other way to do this?
I suppose that the RemoveBackground.so native library you try to use wasn't built for ARM architecture. I'm not sure about Linux, but on Mac OS X you can check the supported architectures of a native library using lipo command. For example:
lipo -info /usr/lib/RemoveBackground.so