1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

Merge pull request #26057 from asmorkalov:as/android_16k_pages

Android builds update #26057

Fixes https://github.com/opencv/opencv/issues/26027
Should also address https://github.com/opencv/opencv/issues/26542
 
Changes:
- Switched to Android build tools 34, NDK 26d, target API level 34 (required by Google Play).
- Use flexible page size on Android by default to support Android 15+.
- Dummy stub for R and BuildConfig classes for javadoc.
- Java 17 everywhere.
- Strict ndkVersion and ABI list in release package.

Related:
- Docker: https://github.com/opencv-infrastructure/opencv-gha-dockerfile/pull/41
- Pipeline: https://github.com/opencv/ci-gha-workflow/pull/183

Related IPP issue with NDK 27+: https://github.com/opencv/opencv/issues/26072

Google documentation for 16kb pages support : https://developer.android.com/guide/practices/page-sizes?hl=en

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Alexander Smorkalov
2024-12-31 11:53:04 +03:00
committed by GitHub
parent 269ff8cd83
commit c803aa2ddd
15 changed files with 91 additions and 23 deletions
+12 -10
View File
@@ -1,5 +1,5 @@
# https://developer.android.com/studio/releases/gradle-plugin
set(ANDROID_GRADLE_PLUGIN_VERSION "7.3.1" CACHE STRING "Android Gradle Plugin version")
set(ANDROID_GRADLE_PLUGIN_VERSION "8.6.0" CACHE STRING "Android Gradle Plugin version")
message(STATUS "Android Gradle Plugin version: ${ANDROID_GRADLE_PLUGIN_VERSION}")
set(KOTLIN_PLUGIN_VERSION "1.8.20" CACHE STRING "Kotlin Plugin version")
@@ -13,16 +13,16 @@ else()
set(KOTLIN_STD_LIB "" CACHE STRING "Kotlin Standard Library dependency")
endif()
set(GRADLE_VERSION "7.6.3" CACHE STRING "Gradle version")
set(GRADLE_VERSION "8.11.1" CACHE STRING "Gradle version")
message(STATUS "Gradle version: ${GRADLE_VERSION}")
set(ANDROID_COMPILE_SDK_VERSION "31" CACHE STRING "Android compileSdkVersion")
set(ANDROID_COMPILE_SDK_VERSION "34" CACHE STRING "Android compileSdkVersion")
if(ANDROID_NATIVE_API_LEVEL GREATER 21)
set(ANDROID_MIN_SDK_VERSION "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android minSdkVersion")
else()
set(ANDROID_MIN_SDK_VERSION "21" CACHE STRING "Android minSdkVersion")
endif()
set(ANDROID_TARGET_SDK_VERSION "31" CACHE STRING "Android minSdkVersion")
set(ANDROID_TARGET_SDK_VERSION "34" CACHE STRING "Android targetSdkVersion")
set(ANDROID_BUILD_BASE_DIR "${OpenCV_BINARY_DIR}/opencv_android" CACHE INTERNAL "")
set(ANDROID_TMP_INSTALL_BASE_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/install/opencv_android")
@@ -35,11 +35,11 @@ include '${ANDROID_ABI}'
")
set(ANDROID_INSTALL_ABI_FILTER "
//reset()
//include 'armeabi-v7a'
//include 'arm64-v8a'
//include 'x86'
//include 'x86_64'
reset()
include 'armeabi-v7a'
include 'arm64-v8a'
include 'x86'
include 'x86_64'
")
if(NOT INSTALL_CREATE_DISTRIB)
set(ANDROID_INSTALL_ABI_FILTER "${ANDROID_BUILD_ABI_FILTER}")
@@ -54,7 +54,9 @@ set(ANDROID_STRICT_BUILD_CONFIGURATION "true")
configure_file("${OpenCV_SOURCE_DIR}/samples/android/build.gradle.in" "${ANDROID_BUILD_BASE_DIR}/build.gradle" @ONLY)
set(ANDROID_ABI_FILTER "${ANDROID_INSTALL_ABI_FILTER}")
set(ANDROID_STRICT_BUILD_CONFIGURATION "false")
# CI uses NDK 26d to overcome https://github.com/opencv/opencv/issues/26072
# It's ahead of default configuration and we have to force version to get non-controversial parts of the package
#set(ANDROID_STRICT_BUILD_CONFIGURATION "false")
configure_file("${OpenCV_SOURCE_DIR}/samples/android/build.gradle.in" "${ANDROID_TMP_INSTALL_BASE_DIR}/${ANDROID_INSTALL_SAMPLES_DIR}/build.gradle" @ONLY)
install(FILES "${ANDROID_TMP_INSTALL_BASE_DIR}/${ANDROID_INSTALL_SAMPLES_DIR}/build.gradle" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}" COMPONENT samples)