Follow these steps to configure and test, no problem.
Download OpenCV SDK for Android, unzip (my decompression address is F:\OPENCV-ANDROID-SDK)
1) New Project project, named Opencvtest (name Random)
2) Minimum SDK selection API 19:android 4.4 (KitKat)
3) Select Empty Activity
Android Studio Menu-->file-->new-->import Module
1) Select F:\opencv-android-sdk/sdk/java
2) Module name:android Studio will automatically populate this entry for openCVLibrary310 without having to control it.
3) Click Next, there will be three check boxes, all selected, click Finish
1) File-->project Structure
2) Select App under the left modules bar
3) Select dependencies in the upper right column
4) Click "+" in the right column to select the third module Dependency
5) Click OK to exit, and then click OK to exit
1) Switch the view from Android to project,
2. Tap the app to open the Build.gradle file in the app root directory and write down
Compilesdkversion
Buildtoolsversion
Minsdkversion
Targetsdkversion
The following values
3) Click OpenCVLibrary310, open the root directory of the Build.gradle file, put the file
Compilesdkversion
Buildtoolsversion
Minsdkversion
Targetsdkversion
Changes to the same value in the app.
4) Click Try Again in the top Gradle Project sync row
1) Copy the Libs folder under F:\OpenCV-android-sdk\sdk\native under the OpenCV SDK for Android file to your Android project, under Opencvtest\app\src\main, and renamed Libs to Jnilibs.
2) At this time the preparatory work is completed, the next can be used in the OPENCV program test
3) Open your main activity Mainactivity.java file, write down the package name, mine is
Package com.xiaoma.opencvtest;, then my bag name is Com.xiaoma.opencvtest
1) Copy the three files in the Opencv-android-sdk\samples\image-manipulations\res () to your Android project opencvtest\app\src\main\ Res (delete three files of the same name in this directory before copying)
2) Copy the Androidmanifest.xml file from Opencv-android-sdk\samples\image-manipulations to your Android project Opencvtest\app\src\main replace
3) The Opencv-android-sdk\samples\image-manipulations\src\org\opencv\samples\ Copy the Imagemanipulationsactivity.java file from Imagemanipulations to your Android project Opencvtest\app\src\main\java\com\xiaoma\ Opencvtest, and delete the original Mainactivity.java file. Where \com\xiaoma\ is different depending on the package name of each person.
1) Open Imagemanipulationsactivity.java,androidmanifest.xml in Android Studio
2) Replace the package name in the file with the package name you noted in the sixth step
3) Change the value of Uses-sdk android:minsdkversion under the Androidmanifest.xml file to the value noted in step five
4) Note This step in the Androidmanifest.xml file to change the package name, do not put the original "" Paste lost
Some hands may eject when they are running.
It seems that the device does not the support camera (or it's locked). Application'll be closed.
At this time to open the mobile app Rights Management, find the application of the program, the permission to change its camera to allow it