mirror of
https://github.com/opencv/opencv.git
synced 2024-12-16 02:19:12 +08:00
6c57ce9e09
Updated Android samples for modern Android studio. Added OpenCV from Maven support. #24473 Updated samples for recent Android studio: - added namespace field that is required in build.gradle files - replaced _switch_ by _if-else_ because it doesn't work with constants from resources - added missed log library dependency in face-detection/jni/CMakeLists.txt - use local.properties to define NDK location Added support for OpenCV from Maven. Now you can choose 3 possible sources of OpenCV lib in settings.gradle: SDK path, local Maven repository, public Maven repository. (Creating Maven repository from SDK is added here #24456 ) There are differences in project configs for SDK and Maven versions: - different dependencies in build.gradle - different OpenCV library names in CMakeLists.txt - SDK version requires OpenCV_DIR definition Requires: - https://github.com/opencv/ci-gha-workflow/pull/124 - https://github.com/opencv-infrastructure/opencv-gha-dockerfile/pull/26
37 lines
1.1 KiB
Groovy
37 lines
1.1 KiB
Groovy
apply plugin: 'com.android.application'
|
|
|
|
android {
|
|
namespace 'org.opencv.samples.tutorial3'
|
|
compileSdkVersion @ANDROID_COMPILE_SDK_VERSION@
|
|
defaultConfig {
|
|
applicationId "org.opencv.samples.tutorial3"
|
|
minSdkVersion @ANDROID_MIN_SDK_VERSION@
|
|
targetSdkVersion @ANDROID_TARGET_SDK_VERSION@
|
|
versionCode 301
|
|
versionName "3.01"
|
|
}
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
sourceSets {
|
|
main {
|
|
java.srcDirs = @ANDROID_SAMPLE_JAVA_PATH@
|
|
aidl.srcDirs = @ANDROID_SAMPLE_JAVA_PATH@
|
|
res.srcDirs = @ANDROID_SAMPLE_RES_PATH@
|
|
manifest.srcFile '@ANDROID_SAMPLE_MANIFEST_PATH@'
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
//implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
if (gradle.opencv_source == "sdk_path") {
|
|
implementation project(':opencv')
|
|
} else if (gradle.opencv_source == "maven_local" || gradle.opencv_source == "maven_cenral") {
|
|
implementation 'org.opencv:opencv:@OPENCV_VERSION_PLAIN@'
|
|
}
|
|
}
|