Reputation: 1508
I've been following this steps to setup OpenCv in my Android Studio project: https://stackoverflow.com/a/27421494/8713068
I've tried both OpenCv 3.4.2 and 3.4.3. I've tried with and without Kotlin support. Despite every step made a few times, I'm still having "Gradle project sync failed." But in Build Window everything is "SUCCESSFUL".
Have any of you tried creating new OpenCv project lately ? What am doing wrong ?
build.gradle of OpenCV
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 23
targetSdkVersion 28
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
build.gradle of app:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myname.test2"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':openCVLibrary342')
}
Steps again:
I've tried to add NDK, didn't help too
Upvotes: 0
Views: 1134
Reputation: 1508
If anyone is also struggling with that, OpenCv brings its own AndroidManifest and it has declared sdk-version on its own.. just remove
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
line and everything should work
Upvotes: 2