Working with open cv on android using java not c++ - android

I am working with OpenCv on android using c++ ,I want to develop using java
Can I do that
many thanks

Yes, you can, Check out this page. A cut and paste from there states:
OpenCV now has bindings for desktop Java, updating the set of supported languages to C / C++, Python, Android, Java and any JVM language which interops with Java, such as Scala and Clojure. The existing Java API for Android has recently been extended to support desktop Java as well. Unlike the popular JavaCV project, these bindings are automatically generated by parsing the OpenCV C++ headers.
There is also javacv, which can be accessed here.

Related

Any way to export Xamarin.Forms app so that I can call from Android Studio Java App? [duplicate]

Currently, we are developing a .NET Standard class library that will be used by different Xamarin.* platforms.
I was wondering if there is a way to use the shared code in a native Android project (maybe produce an AAR/JAR file).
The reason I need this functionality is because our company provides an AAR to one of our customers (that is used by a native Android project), and we would like to keep a single source base instead of two.
Thanks in advance!
Update:
The name changed to ".NET Embedding" and it is at v0.4 at the time of this update.
https://developer.xamarin.com/releases/dotnetembedding/dotnetembedding_0/dotnetembedding_0.4/
New instructions:
Installing .NET Embedding
Original post:
You can use Mono's Embeddinator-4000
It supports various language consumers, so it surfaces .NET code as idiomatic code in the target language. This is the list of supported languages at present:
Objective-C: mapping .NET to idiomatic Objective-C APIs.
Java: mapping .NET to idiomatic Java APIs.
C: mapping .NET to an object-oriented like C APIs.
Embeddinator-4000 is a tool that allows your existing .NET Code (C#, F# and others) to be consumed from other programming languages and in various different environments.
Java is currently in a preview state for macOS, Windows, and Android.
The platform is selected by passing the --platform= command-line argument to the embeddinator. Currently macOS, Windows, and Android are supported.
re: https://mono.github.io/Embeddinator-4000/
As a part of the requires For Android you will need Xamarin.Android 7.4.99+ and Android Studio 3+ (Java 1.8) but if you are building Android apps with Xamarin and Java you would have those already.
Note: This tool is in Preview, so review the open issues and post new if needed.
re: https://github.com/mono/Embeddinator-4000/issues
Note: This is not trans-compiling, but embedding Mono's runtime in a native package that allow CIL code, AOT'd (i.e. iOS) or not to run within a different language/runtime.

How to compile the Xamarin android app with C# classlibrary + C++ Native library?

I have a Chip card reader application which is written by C# and C++ lib as a low-level layer.
Now I want to have the same application in IOS and Android.
So for to achieve this, I have setup the XamarinSDK in VS2017.
I have created the sample android app and imported my existing card reader c# class library and I have calling C++ methods using DllImport inside the C# library and finally compiled both successfully without error.
But when I run the APK on the device it showing exception when calling C++ lib from C# lib.
The code flow is like below image.
So can anyone help me about how to achieve this same?
Highly appreciated your help on this.
Your libs must be compatible with the Android platform. If they're written to Windows or other platform you have to recompile and maybe adapt them. The C# lib tend to be an PCL or .Net Standard lib and the C++ lib have to target the android platform.
I don't have experience with C++ Android development but all C++ applications and libraries have to be compatible with the platform they run.

Convert .NET Standard class library to native aar/jar

Currently, we are developing a .NET Standard class library that will be used by different Xamarin.* platforms.
I was wondering if there is a way to use the shared code in a native Android project (maybe produce an AAR/JAR file).
The reason I need this functionality is because our company provides an AAR to one of our customers (that is used by a native Android project), and we would like to keep a single source base instead of two.
Thanks in advance!
Update:
The name changed to ".NET Embedding" and it is at v0.4 at the time of this update.
https://developer.xamarin.com/releases/dotnetembedding/dotnetembedding_0/dotnetembedding_0.4/
New instructions:
Installing .NET Embedding
Original post:
You can use Mono's Embeddinator-4000
It supports various language consumers, so it surfaces .NET code as idiomatic code in the target language. This is the list of supported languages at present:
Objective-C: mapping .NET to idiomatic Objective-C APIs.
Java: mapping .NET to idiomatic Java APIs.
C: mapping .NET to an object-oriented like C APIs.
Embeddinator-4000 is a tool that allows your existing .NET Code (C#, F# and others) to be consumed from other programming languages and in various different environments.
Java is currently in a preview state for macOS, Windows, and Android.
The platform is selected by passing the --platform= command-line argument to the embeddinator. Currently macOS, Windows, and Android are supported.
re: https://mono.github.io/Embeddinator-4000/
As a part of the requires For Android you will need Xamarin.Android 7.4.99+ and Android Studio 3+ (Java 1.8) but if you are building Android apps with Xamarin and Java you would have those already.
Note: This tool is in Preview, so review the open issues and post new if needed.
re: https://github.com/mono/Embeddinator-4000/issues
Note: This is not trans-compiling, but embedding Mono's runtime in a native package that allow CIL code, AOT'd (i.e. iOS) or not to run within a different language/runtime.

Can I convert an empty project in C++ to an android app through Visual C++?

Like I want to convert a C++ project that I made in VS to an android app. And I found out that there is a Visual C++ android development kit available in VS. So will there be any need of using Java? (as building an android app usually requires)
You can indeed create a Visual Studio project that uses the Android NDK to build an Android app from pure C++ code. The C++ code is compiled into a library that a little bit of Java glue code calls into, and this combination, along with your resources, is packaged into an .APK that you can install. You don't have to edit or otherwise modify the Java code at all; all your program logic can be in C++.
Technically speaking, you can't easily convert an existing VS project into an Android project, but you can copy your code into a new project that creates an Android app, or copy it into a shared code project that is picked up by a project that creates a library for Android that you can call from an app written in either Java or C++. The project templates in VS give simple examples of doing each of these things.

How to integrate C++ file into Android Application using JNI

I want to use C++ file in my android application via JNI but i don't know how to integrate C++ file and how to Compile and run it.
Please help me if anybody knows about it
You need to do NDK programming. Android NDK
The Android NDK is a toolset that lets you embed components that make use of native code in your Android applications.
Android applications run in the Dalvik virtual machine. The NDK allows you to implement parts of your applications using native-code languages such as C and C++. This can provide benefits to certain classes of applications, in the form of reuse of existing code and in some cases increased speed.
You can use Android NDK for your requirements.
Android-NDK
The NDK is a toolset that allows you to implement parts of your app using native-code languages such as C and C++. For certain types of apps, this can be helpful so that you may reuse existing code libraries written in these languages and possibly increased performance.
Tutorial Advanced Android: Getting Started with the NDK
Using Android NDK create shared library of your C,C++ files and load that library at runtime from your Android application. Look at tutorial I linked.

Categories

Resources