JavaCV configuration in Android Studio

I know there are many similar questions, but many of them seem to be outdated due to the development of libraries like JavaCV.

I used the Create Video with Images and Audio code in Android to create a movie, but I have a problem importing lib.

As I said on the JavaCV page, I put the dependency in gradle:

compile group: 'org.bytedeco', name: 'javacv', version: '0.9' 

Now, I don’t know if I need to do something?

I used these imports:

 import org.bytedeco.javacpp.avcodec; import org.bytedeco.javacpp.opencv_core.IplImage; import org.bytedeco.javacv.FFmpegFrameRecorder; import static org.bytedeco.javacpp.opencv_highgui.cvLoadImage; 

and get this error:

 Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil at org.bytedeco.javacpp.Loader.load(Loader.java:387) at org.bytedeco.javacpp.Loader.load(Loader.java:353) at org.bytedeco.javacpp.avformat.<clinit>(avformat.java:13) at org.bytedeco.javacv.FFmpegFrameRecorder.<clinit>(FFmpegFrameRecorder.java:106) at voidstudio.app.activity.CreateMovieTask.doInBackground(CreateMovieTask.java:46) at voidstudio.app.activity.CreateMovieTask.doInBackground(CreateMovieTask.java:21) 

and

 Caused by: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:217) 

and

  Caused by: java.lang.UnsatisfiedLinkError: Couldn't load jniavutil from loader dalvik.system.PathClassLoader[dexPath=/data/app/voidstudio.app-1.apk,libraryPath=/data/app-lib/voidstudio.app-1]: findLibrary returned null at java.lang.Runtime.loadLibrary(Runtime.java:365) at java.lang.System.loadLibrary(System.java:521) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535) at org.bytedeco.javacpp.Loader.load(Loader.java:410) 

Am I missing a configuration? I saw similar questions, but there was no right answer for this.

+5
source share
2 answers

Update! I also found out that if you have the armeabi-v7a folder in jniLibs or you use something other than the armeabi folder, you will have problems adding .so files.

It seems ffmpeg is not being imported. I have the same problem. Here is what I did. Let me know if this helps you!

 compile group: 'org.bytedeco', name: 'javacv', version: '0.9' compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.9-0.9', classifier: 'android-arm' compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.3-0.9', classifier: 'android-arm' 
+7
source

Check jniLibs folder jniLibs

I just changed the placement of my jniLib (before it went beyond the main folder) and it worked for me, please view the image ! hope this helps

+2
source

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


All Articles