Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new Docker environment with Android build tools v30 #26

Merged
merged 5 commits into from
Nov 17, 2023

Conversation

asmorkalov
Copy link
Contributor

@asmorkalov asmorkalov commented Nov 14, 2023

Switched to Android command line tools instead of deprecated sdk-tools.

  • NDK 23.1
  • Java JRE 17
  • Gradle 7.6.3
  • CMake 3.22.1

The environment requires namespace definition in build.gradle.

Switched to Android command line tools instead of deprecated sdk-tools.
- Java JRE 17
- Gradle 7.5.1
- CMake 3.22.1

The environment requires namespace definition in build.gradle.
&& mkdir -p $ANDROID_HOME/cmdline-tools/latest \
&& mv cmdline-tools/* $ANDROID_HOME/cmdline-tools/latest/ \
&& tree $ANDROID_HOME \
&& echo "y\n" > /tmp/yes \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote this script for installing SDK some time ago: https://github.com/mshabunin/opencv-android-build/blob/master/scripts/get_sdk.sh

  • might be necessary to run sdkmanager --update first
  • you can run yes | sdkmanager --licenses once and skip license request further
  • why run several commands when sdkmanager --install <pkg> <pkg> <pkg> ... form can be used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied.

# Image name: quay.io/opencv-ci/opencv-androidsdk-30
# For 4.x branch

FROM ubuntu:20.04
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no 22.04?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just used the same base image as before. It does not actually matters here, because most of work is done by cross tools.

software-properties-common \
build-essential ccache ninja-build \
python3 python3-pip curl zip unzip file \
openjdk-8-jdk openjdk-17-jre libncurses5 tree \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 2 JDKs are necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JDK 8 is used for Android code. JRE 17 is used for SDK tools, Gradle, etc.

apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*

RUN mkdir -p /opt/gradle && \
Copy link
Contributor

@mshabunin mshabunin Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to install system gradle package? I thought that required version will be automatically downloaded by project if necessary.
For example we can see in the logs that gradle 5.6.4 has been used despite having 7.5.1 installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try align gradle version here and in main repo: opencv/opencv#24473. The goal is to re-use everything from docker and do not download tools on the go.

@asmorkalov asmorkalov merged commit 81850d9 into opencv-infrastructure:main Nov 17, 2023
asmorkalov pushed a commit to opencv/opencv that referenced this pull request Nov 17, 2023
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:
- opencv/ci-gha-workflow#124
- opencv-infrastructure/opencv-gha-dockerfile#26
IskXCr pushed a commit to Haosonn/opencv that referenced this pull request Dec 20, 2023
Updated Android samples for modern Android studio. Added OpenCV from Maven support. opencv#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 opencv#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:
- opencv/ci-gha-workflow#124
- opencv-infrastructure/opencv-gha-dockerfile#26
@opencv-alalek opencv-alalek removed their request for review December 26, 2023 20:43
thewoz pushed a commit to thewoz/opencv that referenced this pull request Jan 4, 2024
Updated Android samples for modern Android studio. Added OpenCV from Maven support. opencv#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 opencv#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:
- opencv/ci-gha-workflow#124
- opencv-infrastructure/opencv-gha-dockerfile#26
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
Updated Android samples for modern Android studio. Added OpenCV from Maven support. opencv#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 opencv#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:
- opencv/ci-gha-workflow#124
- opencv-infrastructure/opencv-gha-dockerfile#26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants