After Android Studio uses OpenCV, the APP can run without installing OpenCV Manager. androidopencv
Reprinted from http://www.cnblogs.com/tail/p/4618790.html
The static initialization method is used. You can click the link below to view the official document introduction.
Http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#application-development-with-static-initialization
If the project does not contain the JNI part, the simple method is:
1) log out OpenCVLoader. initAsync (OpenCVLoader. OPENCV_VERSION_2_4_3, this, mLoaderCallback); set it to SUCCESS directly on the statement.
public void onResume() { super.onResume(); mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); //OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback); }
2) Add static methods to the Activity class
static{ if(!OpenCVLoader.initDebug()){ //handle initialization error } }
If other custom native libraries need to be loaded, you can add the else statement here:
static{ if(!OpenCVLoader.initDebug()){ //handle initialization error }else{ System.loadLibrary("my_jni_lib1"); System.loadLibrary("my_jni_lib2"); }}