OpenCV : build with Glade on Android(安卓)Studio
16lz
2021-01-26
OpenCV : build with Glade on Android Studio
FROM : http://stackoverflow.com/questions/17767557/how-to-use-opencv-in-android-studio-using-gradle-build-tool
Android Studio 0.8.2+ and above, could easily import modules. Thanks to TGMCains answer, is simplified, by using Android Studio itself to import OpenCV as a module.
- Downloadlatest OpenCV sdk for Android fromOpenCV.organd decompress the zip file.
- Import OpenCV to Android Studio, FromFile -> Import Module, choosesdk/javafolder in the unzipped opencv archive.
- Update build.gradleunder imported OpenCV module to update 4 fields to match your project build.gradle a) compileSdkVersion b) buildToolsVersion c) minSdkVersion and 4) targetSdkVersion.
- Add module dependencybyApplication -> Module Settings, and select theDependenciestab. Click+icon at bottom, chooseModule Dependencyand select the imported OpenCV module.
- Copylibsfolder undersdk/nativeto Android Studio underapp/src/main.
- In Android Studio,rename the copiedlibsdirectory tojniLibsand we are done.
Step (6) is since Android studio expects native libs inapp/src/main/jniLibs
instead of olderlibs
folder. For those new to Android OpenCV, don't miss below steps
- include
static{ System.loadLibrary("opencv_java"); }
- For step(5), if you ignore any platform libs like x86, make sure your device/emulator is not on that platform.
OpenCV written is in C/C++. Java wrappers are
- Android OpenCV SDK- OpenCV.org maintained Android Java wrapper. I suggest this one.
- OpenCV Java- OpenCV.org maintained auto generated desktop Java wrapper.
- JavaCV- Popular Java wrapper maintained by independent developer(s). Not Android specific. This librarymightget out of sync with OpenCV newer versions.
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer