From fde99e68c02d10401f1d7c85c34919760cf910f7 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Wed, 10 Jan 2024 16:22:03 +0300 Subject: [PATCH] Removed Android AIDL from build scrips and tutorials as it's not needed since 4.9.0. --- cmake/android/android_gradle_projects.cmake | 4 ---- .../android_binary_package/dev_with_OCV_on_Android.markdown | 3 +-- modules/java/CMakeLists.txt | 4 +--- modules/java/android_sdk/android_gradle_lib/build.gradle | 1 - modules/java/android_sdk/build.gradle.in | 4 ---- modules/java/generator/gen_java.py | 4 ++-- platforms/android/aar-template/OpenCV/build.gradle.template | 4 +--- samples/android/15-puzzle/build.gradle.in | 1 - samples/android/camera-calibration/build.gradle.in | 1 - samples/android/color-blob-detection/build.gradle.in | 1 - samples/android/face-detection/build.gradle.in | 1 - samples/android/image-manipulations/build.gradle.in | 1 - samples/android/mobilenet-objdetect/build.gradle.in | 1 - samples/android/qr-detection/build.gradle.in | 1 - samples/android/tutorial-1-camerapreview/build.gradle.in | 1 - samples/android/tutorial-2-mixedprocessing/build.gradle.in | 1 - samples/android/tutorial-3-cameracontrol/build.gradle.in | 1 - samples/android/tutorial-4-opencl/build.gradle.in | 1 - samples/android/video-recorder/build.gradle.in | 1 - 19 files changed, 5 insertions(+), 31 deletions(-) diff --git a/cmake/android/android_gradle_projects.cmake b/cmake/android/android_gradle_projects.cmake index 9b3e7fbc9f..2b79806fa8 100644 --- a/cmake/android/android_gradle_projects.cmake +++ b/cmake/android/android_gradle_projects.cmake @@ -89,15 +89,11 @@ else() ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "") endif() -# set android gradle java version in build.gradle and set aidl config if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "8.0.0")) # AGP-8.0 requires a minimum JDK version of JDK17 ocv_update(ANDROID_GRADLE_JAVA_VERSION_INIT "17") - # Enable aidl configuration for OpenCV compile with AGP-8.0 - ocv_update(ANDROID_GRADLE_BUILD_FEATURE_AIDL "buildFeatures { aidl true }") else() ocv_update(ANDROID_GRADLE_JAVA_VERSION_INIT "1_8") - ocv_update(ANDROID_GRADLE_BUILD_FEATURE_AIDL "") endif() set(ANDROID_GRADLE_JAVA_VERSION "${ANDROID_GRADLE_JAVA_VERSION_INIT}" CACHE STRING "Android Gradle Java version") diff --git a/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.markdown b/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.markdown index 68d7ab3644..455745db6a 100644 --- a/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.markdown +++ b/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.markdown @@ -75,11 +75,10 @@ In addition to this instruction you can use some video guide, for example [this @endcode The fix was found [here](https://stackoverflow.com/questions/73225714/import-opencv-sdk-to-android-studio-chipmunk) -6. OpenCV project uses `aidl` and `buildConfig` features. Please enable them in +6. OpenCV project uses `buildConfig` feature. Please enable it in `MyApplication/OpenCV/build.gradle` file to `android` block: @code{.gradle} buildFeatures{ - aidl true buildConfig true } diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index 7fe90a0cb3..7207997e1b 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -17,7 +17,7 @@ ocv_add_module(java BINDINGS opencv_core opencv_imgproc PRIVATE_REQUIRED opencv_ include(${CMAKE_CURRENT_SOURCE_DIR}/common.cmake) -# UTILITY: glob specific sources and append them to list (type is in H, CPP, JAVA, AIDL) +# UTILITY: glob specific sources and append them to list (type is in H, CPP, JAVA) macro(glob_more_specific_sources _type _root _output) unset(_masks) if(${_type} STREQUAL "H") @@ -26,8 +26,6 @@ macro(glob_more_specific_sources _type _root _output) set(_masks "${_root}/cpp/*.cpp") elseif(${_type} STREQUAL "JAVA") set(_masks "${_root}/java/*.java" "${_root}/java/*.java.in") - elseif(${_type} STREQUAL "AIDL") - set(_masks "${_root}/java/*.aidl") endif() if (_masks) file(GLOB _result ${_masks}) diff --git a/modules/java/android_sdk/android_gradle_lib/build.gradle b/modules/java/android_sdk/android_gradle_lib/build.gradle index b887cdb4b9..4394bd9a4e 100644 --- a/modules/java/android_sdk/android_gradle_lib/build.gradle +++ b/modules/java/android_sdk/android_gradle_lib/build.gradle @@ -42,7 +42,6 @@ android { main { jniLibs.srcDirs = ['../../jni'] java.srcDirs = ['src'] // TODO Use original files instead of copied into build directory - aidl.srcDirs = ['src'] res.srcDirs = ['@OpenCV_SOURCE_DIR@/modules/java/android_sdk/android_gradle_lib/res'] manifest.srcFile 'AndroidManifest.xml' } diff --git a/modules/java/android_sdk/build.gradle.in b/modules/java/android_sdk/build.gradle.in index 15bfdbefc1..d3e37d0362 100644 --- a/modules/java/android_sdk/build.gradle.in +++ b/modules/java/android_sdk/build.gradle.in @@ -121,8 +121,6 @@ android { targetCompatibility JavaVersion.VERSION_@ANDROID_GRADLE_JAVA_VERSION_INIT@ } - @ANDROID_GRADLE_BUILD_FEATURE_AIDL@ - buildTypes { debug { packagingOptions { @@ -139,7 +137,6 @@ android { } buildFeatures { - aidl true prefabPublishing true buildConfig true } @@ -153,7 +150,6 @@ android { main { jniLibs.srcDirs = ['native/libs'] java.srcDirs = ['java/src'] - aidl.srcDirs = ['java/src'] res.srcDirs = ['java/res'] manifest.srcFile 'java/AndroidManifest.xml' } diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py index c893c0833a..88523b2c31 100755 --- a/modules/java/generator/gen_java.py +++ b/modules/java/generator/gen_java.py @@ -1240,13 +1240,13 @@ JNIEXPORT void JNICALL Java_org_opencv_%(module)s_%(j_cls)s_delete def copy_java_files(java_files_dir, java_base_path, default_package_path='org/opencv/'): global total_files, updated_files java_files = [] - re_filter = re.compile(r'^.+\.(java|aidl|kt)(.in)?$') + re_filter = re.compile(r'^.+\.(java|kt)(.in)?$') for root, dirnames, filenames in os.walk(java_files_dir): java_files += [os.path.join(root, filename) for filename in filenames if re_filter.match(filename)] java_files = [f.replace('\\', '/') for f in java_files] re_package = re.compile(r'^package +(.+);') - re_prefix = re.compile(r'^.+[\+/]([^\+]+).(java|aidl|kt)(.in)?$') + re_prefix = re.compile(r'^.+[\+/]([^\+]+).(java|kt)(.in)?$') for java_file in java_files: src = checkFileRemap(java_file) with open(src, 'r') as f: diff --git a/platforms/android/aar-template/OpenCV/build.gradle.template b/platforms/android/aar-template/OpenCV/build.gradle.template index 4f3a3846ec..23d88a6910 100644 --- a/platforms/android/aar-template/OpenCV/build.gradle.template +++ b/platforms/android/aar-template/OpenCV/build.gradle.template @@ -39,7 +39,6 @@ android { } } buildFeatures { - aidl true prefabPublishing true buildConfig true } @@ -52,7 +51,6 @@ android { main { java.srcDirs = ['src/main/java'] //jniLibs.srcDirs = ['libs'] - aidl.srcDirs = ['src/main/java'] } } @@ -85,4 +83,4 @@ publishing { } dependencies { -} \ No newline at end of file +} diff --git a/samples/android/15-puzzle/build.gradle.in b/samples/android/15-puzzle/build.gradle.in index b2a8975dce..e7f6b4af56 100644 --- a/samples/android/15-puzzle/build.gradle.in +++ b/samples/android/15-puzzle/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' } diff --git a/samples/android/camera-calibration/build.gradle.in b/samples/android/camera-calibration/build.gradle.in index 3cd3d9200e..8c97fb22ab 100644 --- a/samples/android/camera-calibration/build.gradle.in +++ b/samples/android/camera-calibration/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' } diff --git a/samples/android/color-blob-detection/build.gradle.in b/samples/android/color-blob-detection/build.gradle.in index b0c50859f9..bd29338970 100644 --- a/samples/android/color-blob-detection/build.gradle.in +++ b/samples/android/color-blob-detection/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' } diff --git a/samples/android/face-detection/build.gradle.in b/samples/android/face-detection/build.gradle.in index 6fc4ce26c7..72dabd664d 100644 --- a/samples/android/face-detection/build.gradle.in +++ b/samples/android/face-detection/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' } diff --git a/samples/android/image-manipulations/build.gradle.in b/samples/android/image-manipulations/build.gradle.in index b12701f377..3c5034ea9b 100644 --- a/samples/android/image-manipulations/build.gradle.in +++ b/samples/android/image-manipulations/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' } diff --git a/samples/android/mobilenet-objdetect/build.gradle.in b/samples/android/mobilenet-objdetect/build.gradle.in index 377d151d1b..9e8e49b668 100644 --- a/samples/android/mobilenet-objdetect/build.gradle.in +++ b/samples/android/mobilenet-objdetect/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' } diff --git a/samples/android/qr-detection/build.gradle.in b/samples/android/qr-detection/build.gradle.in index 469dea609c..0951b70cdb 100644 --- a/samples/android/qr-detection/build.gradle.in +++ b/samples/android/qr-detection/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' } diff --git a/samples/android/tutorial-1-camerapreview/build.gradle.in b/samples/android/tutorial-1-camerapreview/build.gradle.in index deb9cf1b03..7b308b2abb 100644 --- a/samples/android/tutorial-1-camerapreview/build.gradle.in +++ b/samples/android/tutorial-1-camerapreview/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' } diff --git a/samples/android/tutorial-2-mixedprocessing/build.gradle.in b/samples/android/tutorial-2-mixedprocessing/build.gradle.in index e0f0a6b3c7..a156f42240 100644 --- a/samples/android/tutorial-2-mixedprocessing/build.gradle.in +++ b/samples/android/tutorial-2-mixedprocessing/build.gradle.in @@ -33,7 +33,6 @@ android { 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@' } diff --git a/samples/android/tutorial-3-cameracontrol/build.gradle.in b/samples/android/tutorial-3-cameracontrol/build.gradle.in index d83f37d74e..d9c7f29ac3 100644 --- a/samples/android/tutorial-3-cameracontrol/build.gradle.in +++ b/samples/android/tutorial-3-cameracontrol/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' } diff --git a/samples/android/tutorial-4-opencl/build.gradle.in b/samples/android/tutorial-4-opencl/build.gradle.in index d9c8cda60e..8eeb12b17d 100644 --- a/samples/android/tutorial-4-opencl/build.gradle.in +++ b/samples/android/tutorial-4-opencl/build.gradle.in @@ -35,7 +35,6 @@ android { 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@' } diff --git a/samples/android/video-recorder/build.gradle.in b/samples/android/video-recorder/build.gradle.in index 506d98ce44..d096f3190a 100644 --- a/samples/android/video-recorder/build.gradle.in +++ b/samples/android/video-recorder/build.gradle.in @@ -19,7 +19,6 @@ android { 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@' }