OpenCV in Android Studio

前端 未结 8 1585
独厮守ぢ
独厮守ぢ 2020-11-22 02:43

I want to use OpenCV library in my app with Android Studio. I followed instructions found here but I get error

Configuration with name \'default\' no

8条回答
  •  不知归路
    2020-11-22 03:17

    For everyone who felt they want to run away with all the steps and screen shots on the (great!) above answers, this worked for me with android studio 2.2.1:

    1. Create a new project, name it as you want and take the default (minSdkVersion 15 is fine).

    2. Download the zip file from here: https://sourceforge.net/projects/opencvlibrary/files/opencv-android/ (I downloaded 3.2.0 version, but there may be a newer versions).

    3. Unzip the zip file, the best place is in your workspace folder, but it not really matter.

    4. Inside Android Studio, click File->New-> Import Module and navigate to \path_to_your_unzipped_file\OpenCV-android-sdk\sdk\java and hit Ok, then accept all default dialogs.

    5. In the gradle file of your app module, add this to the dependencies block:

       dependencies {
           compile project(':openCVLibraryXYZ')
           //rest of code
       }
      

    Where XYZ is the exact version you downloaded, for example in my case:

        dependencies {
            compile project(':openCVLibrary320')
            //rest of code
        }
    

提交回复
热议问题