I used this SO answer as a guide, and did the following, but when I copy the app's .apk
file from its bin
directory, transfer it to a phone which doesn't have OpenCV Manager installed, it prompts and requires to install it first
The OpenCV4Android library project is already in my Workspace in Eclipse. The application I am talking about does have a reference of the OpenCV library, as it was running on a device which had OpenCV Manager installed.
Now, the SO answer which I referred to provides a link to this tutorial. In the tutorial, at this point, it is stated,
If your application project doesn’t have a JNI part, just copy the corresponding OpenCV native libs from
<OpenCV-2.4.11-android-sdk>/sdk/native/libs/<target_arch>
to your project directory to folder libs/.In case of the application project with a JNI part,...
I believe my app does Not have a JNI part, because I don't even know what JNI is. It is a simple, basic app which doesn't do much.
I am confused about the <target_arch>
part of the path given. In my computer, I copied the following directory to my project's libs
folder:
D:\Android\OpenCVv2.4.11\OpenCV-android-sdk\sdk\native\libs\x86
And lastly, in my MainActivity.java
, I do initialize the library like:
private BaseLoaderCallback baseLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS: {
Log.i(TAG, "OpenCV loaded successfully!");// check
openCvCameraBridge.enableView();
}
break;
default: {
super.onManagerConnected(status);
}
break;
}
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
...
setContentView(R.layout.activity_main);
openCvCameraBridge = (CameraBridgeViewBase) findViewById(R.id.mainActivity_javaCameraView);
openCvCameraBridge.setCvCameraViewListener(this);
}
@Override
public void onResume() {
super.onResume();
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, baseLoaderCallback);
}