[英]Initializing OpenCv on Android (Studio 3.2.1), target SDK 28
I've been following this steps to setup OpenCv in my Android Studio project: https://stackoverflow.com/a/27421494/8713068 我一直在按照以下步骤在Android Studio项目中设置OpenCv: https ://stackoverflow.com/a/27421494/8713068
I've tried both OpenCv 3.4.2 and 3.4.3. 我已经尝试过OpenCv 3.4.2和3.4.3。 I've tried with and without Kotlin support. 在没有Kotlin支持的情况下,我尝试过。 Despite every step made a few times, I'm still having "Gradle project sync failed." 尽管已多次执行每个步骤,但我仍然遇到“ Gradle项目同步失败”的情况。 But in Build Window everything is "SUCCESSFUL". 但是在“生成窗口”中,所有内容均为“成功”。
Have any of you tried creating new OpenCv project lately ? 你们最近有没有尝试过创建新的OpenCv项目? What am doing wrong ? 怎么了?
build.gradle of OpenCV OpenCV的build.gradle
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: 应用程序的build.gradle:
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 我尝试添加NDK,也没有帮助
如果有人还与挣扎,OpenCV的带来了自己的AndroidManifest并已宣布它自己的SDK版本..只是删除<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
行和一切应该管用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.