Hi everyone! Did anyone have any experience using...
# multiplatform
n
Hi everyone! Did anyone have any experience using OpenCV in android part of multiplatform project? I created multiplatform project in IDEA from scratch. After that I opened android part in Android Studio and followed steps from here : https://android.jlelse.eu/a-beginners-guide-to-setting-up-opencv-android-library-on-android-studio-19794e220f3c But after I imported new module gradle gave me an error (see the image). It’s possible to import OpenCV in usual way? Thanks.
l
@Nikolai Aren't you missing
jcenter()
in the buildscript repositories?
n
This error appeared after I imported opencv module. Do I need have a buildscript in module?
g
You need buildscript.repositories on root project or child project where you applied you plugin
n
Ok, I found the reason of problem (but to be honest I don't understand it, but still). Initially we have an settings.gradle in root folder for multiplatform project with following content:
Copy code
pluginManagement {
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == "kotlin-multiplatform") {
                useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
            }
        }
    }
}
rootProject.name = 'ZooracleNative'

include ':app'

enableFeaturePreview("GRADLE_METADATA")
Then I am adding openCV module in android part (app) it creates it's own settings.gradle to include new library :
Copy code
::openCV
And looks like they are conflicting with each other. But I don't know how to resolve it yet.
g
You should have only one settings.gradle per Gradle multimodule project. The only case when you have additional settings files: composite builds (when include one project to another) and buildSrc (which is also implemented as a separate project)
I believe your new module should be just a submodule of existing project, not a completely separate one, just include openCV library module on root settings.gradle
n
@gildor Thanks, trying implement it in this way.