Reputation: 213
I am trying get JavaCV working for android in order to gain the use of the FFMPEG library. I'm following the setup instructions for android from the JavaCV website which I've copied below:
Eclipse (Android 2.2 or newer): Follow the instructions on this page: http://developer.android.com/training/basics/firstapp/ Go to File > New > Folder, select your project as parent folder, type "libs/armeabi" as Folder name, and click Finish. Copy javacpp.jar and javacv.jar into the newly created "libs" folder. Extract all the *.so files from javacv-android-arm.jar, opencv-2.4.3-android-arm.zip, and ffmpeg-1.0-android-arm.zip directly into the newly created "libs/armeabi" folder, without creating any new subdirectories. Navigate to Project > Properties > Java Build Path > Libraries and click "Add JARs...". Select both javacpp.jar and javacv.jar from the newly created "libs" folder.
I am trying to use the FFmpegFrameGrabber class in my code. When I run, I get this error from logcat:
02-01 14:40:35.550: W/dalvikvm(11583): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/googlecode/javacv/cpp/avutil;
02-01 14:40:35.550: W/dalvikvm(11583): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/googlecode/javacv/cpp/avcodec;
02-01 14:40:35.550: D/AndroidRuntime(11583): Shutting down VM
02-01 14:40:35.550: W/dalvikvm(11583): threadid=1: thread exiting with uncaught exception (group=0x40015560)
This led me to believe that my android app can't find avutil.so and avcodec.so, which I placed in the libs/armeabi folder. However, when I unzipped the APK eclipse generated, both so files were present.
Any ideas as to the cause of this problem?
Upvotes: 1
Views: 663
Reputation: 408
For anyone that would come across this problem, I've set up a Gist providing step by step instruction on how to set up JavaCV 1.1 on Android Studio 2.1.1.
This tut will use JavaCV 1.1, version 1.2 currently has SIGSEGV issue. JavaCV 1.1 comes with FFmpeg 2.8.1.
libs
folder of your project (app/libs
in my case).app
-> F4
-> Dependencies
-> +
-> File dependencies
-> choose all the previous .jar.targetSdkVersion 22
the app's build.gradle
.packagingOptions
in the build.gradle
:android { compileSdkVersion 23 buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
exclude 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
//might need these if you use openCV
//exclude 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
//exclude 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
}
}
Upvotes: 0