EDIT. Solution in this post is deprecated and may contain some errors. Please see recent, correct post at the bottom of the page.
Ok, I did it on my own :). So here is what we should do to use JavaCV in Android Studio:
1) First we should add such dependencies to build.gradle inside project:
dependencies {
compile group: 'com.googlecode.javacpp', name: 'javacpp', version: '0.7'
compile group: 'com.googlecode.javacv', name: 'javacv', version: '0.7'}
(I mean: build.gradle inside our module directory)
Thanks that we get javacv.jar and javacpp.jar inside external libraries (if not, we
should restart Android Studio).
2) If we follow the Eclipse instruction on
javacv official site
we are now in point 4.:
Extract all the *.so files rom javacv-android-arm.jar,
opencv-2.4.8-android-arm.jar, and ffmpeg-2.1.1-android-arm.jar
directly into the newly created "libs/armeabi" folder, without
creating any of the subdirectories found in the JAR files.
We have to extract all *.so files which we need, but then we should join them to our project in other special way:
3rd answer here says about it,
but generally, we should:
- Create new 'armeabi' directory
- Put interesting .so files into 'armeabi' directory
- Create armeabi.zip
- Change extension of armeabi.zip to armeabi.jar
- Put armeabi.jar to 'libs' directory
- Make sure that build.gradle of our module contains such dependency:
compile fileTree(dir: 'libs', include: ['*.jar'])
3) Enjoy your OpenCV and JavaCv in Android Studio (and don't forget to add
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
to your AndroidManifest.xml if you want to read/save image from/to sdcard and try thanks this,
that your project works well).
/////////////////////////////////////////////////////////
If something is wrong, please write about it in comments.