Could someone tell me where I'm doing wrong? These are the steps that I have followed:
Downloaded the adt-bundle-windows from android developer website
Created a new project and a libs/armeabi 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.
(A part that I don't understand is "Extract all the *.so files from javacv-android-arm.jar", I simply inserted the javacv-android-arm.jar file inside libs/armeabi folder)
Navigated to Project > Properties > Java Build Path > Libraries and click "Add JARs...".
Selected both javacpp.jar and javacv.jar from the newly created "libs" folder.
After that I have downloaded OpenCV2.4.3 from here and ffmpeg from here and extracted the files on my C:/ root. Finally after setting my system path...,
C:\opencv\build\x64\vc10\bin;C:\ffmpeg-64\bin;C:\Program Files\Java\jdk1.7.0_10\bin
...if I try to use simply FrameGrabber in my Android application...
import com.googlecode.javacv.FFmpegFrameGrabber;
import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.*;
import com.googlecode.javacv.cpp.*;
import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_calib3d.*;
import static com.googlecode.javacv.cpp.opencv_objdetect.*;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FFmpegFrameGrabber i = new FFmpegFrameGrabber("/mnt/sdcard/SinglePerson.avi");
}
...I get the following errors:
01-29 17:59:26.976: E/AndroidRuntime(30656): FATAL EXCEPTION: main
01-29 17:59:26.976: E/AndroidRuntime(30656): java.lang.NoClassDefFoundError: com.googlecode.javacv.FFmpegFrameGrabber
01-29 17:59:26.976: E/AndroidRuntime(30656): at com.example.xxxxxxxxx.MainActivity.onCreate(MainActivity.java:23)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.Activity.performCreate(Activity.java:4465)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.os.Handler.dispatchMessage(Handler.java:99)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.os.Looper.loop(Looper.java:137)
01-29 17:59:26.976: E/AndroidRuntime(30656): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-29 17:59:26.976: E/AndroidRuntime(30656): at java.lang.reflect.Method.invokeNative(Native Method)
01-29 17:59:26.976: E/AndroidRuntime(30656): at java.lang.reflect.Method.invoke(Method.java:511)
01-29 17:59:26.976: E/AndroidRuntime(30656): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-29 17:59:26.976: E/AndroidRuntime(30656): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-29 17:59:26.976: E/AndroidRuntime(30656): at dalvik.system.NativeStart.main(Native Method)
Someone can help me please?
So a jar file is basically a zip file, if you change the extension to ".zip" you can extract the files it contains like you did with OpenCV and FFMPEG.
So, rename "javacv-android-arm.jar" to " javacv-android-arm.zip," extract the .so files out of it and copy them to libs/armeabi.
Good luck!