OpenCV in Android Studio

前端 未结 8 1762
独厮守ぢ
独厮守ぢ 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 02:56

    Download
    

    Get the latest pre-built OpenCV for Android release from https://github.com/opencv/opencv/releases and unpack it (for example, opencv-4.4.0-android-sdk.zip).

    Create an empty Android Studio project

    Open Android Studio. Start a new project. 
    

    Keep default target settings.

    Use "Empty Activity" template. Name activity as MainActivity with a corresponding layout activity_main. Plug in your device and run the project. It should be installed and launched successfully before we'll go next.

     Add OpenCV dependency
    

    Go to File->New->Import module

    and provide a path to unpacked_OpenCV_package/sdk/java. The name of module detects automatically. Disable all features that Android Studio will suggest you on the next window.

    Configure your library build.gradle (openCVLibrary build.gradle)

    apply plugin: 'com.android.library'
    
    android {
        compileSdkVersion 28
        buildToolsVersion "28.0.3"
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    }
    

    Implement the library to the project (application build.gradle)

     implementation project(':openCVLibrary330')
    

提交回复
热议问题