Using the Android library on a regular Java project

I want to use the android class for a regular java project project without an android. In particular, I want to use the FaceDetector from android.media. I know that there are OpenCV and other libraries that I can use to detect faces in the image, but I'm looking to use the android library. Is there any way to link android library with java project? Thanks

+6
source share
2 answers
  • Go to java project build path
  • Add New External Jar
  • Go to the installation location of your Android platform (usually C: \ Program Files (x86) \ Android)
  • In android-sdk \ platform \ android-x (where x is the version of your android) select the android.jar file to add to the project.

    Now you have the android library under the reference libraries, and you can use all the classes for Android in your java project.

Another way to do this is to use the android source, get only the java files you need from the Android library, and put them in your java project. Well, when you do it this way, you can change the code and make it more compatible with your java work.

+4
source

The android library may contain some system API calls. Look for them before you include the library with the above steps. I would recommend you look into the android library documentation and look for hooks where it calls the Android system API. Modify the source to use your webcam API and then enable it as a library

+1
source

Source: https://habr.com/ru/post/912713/


All Articles