Skip to content

android: add configuration for NDK 25 and Android API 32 (12L)#22690

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
alalek:android_config_ndk25
Oct 25, 2022
Merged

android: add configuration for NDK 25 and Android API 32 (12L)#22690
asmorkalov merged 1 commit intoopencv:4.xfrom
alalek:android_config_ndk25

Conversation

@alalek
Copy link
Copy Markdown
Member

@alalek alalek commented Oct 24, 2022

This PR provides modern Android build configuration.

Usage example with NDK 25b:

export ANDROID_NDK="/opt/android/android-sdk.studio/ndk/25.1.8937393"
export ANDROID_SDK="/opt/android/android-sdk.studio"
export ANDROID_SDK_ROOT="/opt/android/android-sdk.studio"
#export ANDROID_NATIVE_API_LEVEL=28
python3 ${OPENCV_SRC_DIR}/platforms/android/build_sdk.py --config ndk-25.config.py --use_android_buildtools

Note:

  • --use_android_buildtools is recommended to use cmake&ninja tools from Android SDK instead of system packages (cmake package should be pre-installed through sdkmanager).
  • ANDROID_NATIVE_API_LEVEL is optional (default=32), use 28 for Android 9 (versions list)

List of preinstalled packages:

$ /opt/android/android-sdk.studio/cmdline-tools/latest/bin/sdkmanager --list_installed --include_obsolete
Installed packages:=====================] 100% Fetch remote repository...       
  Path                                           | Version      | Description                             | Location                                      
  -------                                        | -------      | -------                                 | -------                                       
  build-tools;33.0.0                             | 33.0.0       | Android SDK Build-Tools 33              | build-tools/33.0.0                            
  cmake;3.22.1                                   | 3.22.1       | CMake 3.22.1                            | cmake/3.22.1                                  
  cmdline-tools;latest                           | 7.0          | Android SDK Command-line Tools (latest) | cmdline-tools/latest                          
  ndk;25.1.8937393                               | 25.1.8937393 | NDK (Side by side) 25.1.8937393         | ndk/25.1.8937393                              
  patcher;v4                                     | 1            | SDK Patch Applier v4                    | patcher/v4                                    
  platform-tools                                 | 33.0.3       | Android SDK Platform-Tools              | platform-tools                                
  platforms;android-32                           | 1            | Android SDK Platform 32                 | platforms/android-32                          
  platforms;android-33                           | 2            | Android SDK Platform 33                 | platforms/android-33                          
  sources;android-32                             | 1            | Sources for Android 32                  | sources/android-32                            
  sources;android-33                             | 1            | Sources for Android 33                  | sources/android-33                            

Installed Obsolete Packages:
  Path    | Version | Description       | Location
  ------- | ------- | -------           | ------- 
  tools   | 26.1.1  | Android SDK Tools | tools

@asmorkalov asmorkalov self-requested a review October 25, 2022 11:39
@asmorkalov asmorkalov self-assigned this Oct 25, 2022
@asmorkalov asmorkalov added this to the 4.7.0 milestone Oct 25, 2022
@asmorkalov asmorkalov merged commit 0c92305 into opencv:4.x Oct 25, 2022
@alalek alalek mentioned this pull request Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants