Another note to myself which I hope will be useful for others searching it.
Add the following lines to your PRO file in Qt, or create a PRI file using the following and include that in your PRO file.
Note that it is assumed here that OpenCV for Android is extracted to “C:/opencv/OpenCV-android-sdk”
INCLUDEPATH += C:/opencv/OpenCV-android-sdk/sdk/native/jni/include OPENCV3RDPARTYLIBS = C:/opencv/OpenCV-android-sdk/sdk/native/3rdparty/libs/armeabi-v7a OPENCVNATIVELIBS = C:/opencv/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a LIBS += $$OPENCV3RDPARTYLIBS/liblibtiff.a \ $$OPENCV3RDPARTYLIBS/liblibjpeg.a \ $$OPENCV3RDPARTYLIBS/liblibjasper.a \ $$OPENCV3RDPARTYLIBS/liblibpng.a \ $$OPENCV3RDPARTYLIBS/libtbb.a \ $$OPENCV3RDPARTYLIBS/libIlmImf.a LIBS += $$OPENCVNATIVELIBS/libopencv_core.a \ $$OPENCVNATIVELIBS/libopencv_androidcamera.a \ $$OPENCVNATIVELIBS/libopencv_flann.a \ $$OPENCVNATIVELIBS/libopencv_imgproc.a \ $$OPENCVNATIVELIBS/libopencv_highgui.a \ $$OPENCVNATIVELIBS/libopencv_features2d.a \ $$OPENCVNATIVELIBS/libopencv_calib3d.a \ $$OPENCVNATIVELIBS/libopencv_ml.a \ $$OPENCVNATIVELIBS/libopencv_objdetect.a \ $$OPENCVNATIVELIBS/libopencv_photo.a \ $$OPENCVNATIVELIBS/libopencv_stitching.a \ $$OPENCVNATIVELIBS/libopencv_superres.a \ $$OPENCVNATIVELIBS/libopencv_ts.a \ $$OPENCVNATIVELIBS/libopencv_video.a \ $$OPENCVNATIVELIBS/libopencv_videostab.a \ $$OPENCVNATIVELIBS/libopencv_java.so
Note that you need to copy “libopencv_java.so” to “android-sourceslibsarmeabi-v7a” under your project folder. (If you forget this you’ll face an error mentioning the missing Library file!)
Obviously you should also have the following line in your PRO file so that Qt looks for your Android override files and resources here:
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources
Here OpenCV 2 and Qt 5.4 are used but it should be pretty much the same for other versions. (Later versions perhaps)
(Updated on 2015-12-15)
Or you can just simply download my .PRI file below and include it in your project (if you have OpenCV installed in C drive’s root)