Using Android Library on a Regular Java Project

android, class, face-detection, java

Solution

Go to build path of your java project

Add a new external jar

Browse to the location of your android platform installation (usually C:\Program Files (x86)\Android)

Under android-sdk\platforms\android-x (where x is the version of android you have) select the android.jar file to add to the project.

Now you have the android library under the referenced libraries, and you can use whatever android classes you want in your java project.

Another way of doing that is to use the android source, get only the java files you need from the android library and put them into your java project. The good thing when you do it this way is that you can modify the code and make it more compatible with your java work.

Problem

I am looking to use an android class on a regular non-android java project. Specifically I want to use FaceDetector from android.media I know that there are OpenCV and other libraries I can use to detect a face in an image but I am looking to use androids library. Is there a way to link androids library to a java project? Thanks

Original source