cpp_client_telemetry
cpp_client_telemetry copied to clipboard
Modernize android build
The current android build uses an outdated Gradle, cmake and java build dependencies and requires outdated IDE Android Studio 4 to run the project
Suggested to upgrade
- Gradle and android Gradle plugin
- Compile SDK version
- Cmake
- Test project dependcies
- Java 17
Can we upgrade it? Is there any additional guidance?
@anod It would be good to upgrade the android build toolset we are using. I am not Java/Android expert, will this anyway change the minimum sdk version we correctly support, as I know few teams still needing support for Android 4.4 (sdk level 19) ?
Thanks @lalitb I think there is no need to update minimum version. I will test and comeback with more details. it might require to upgrade cmake, is there limitation for cmake version capabilities.
it might require to upgrade cmake, is there limitation for cmake version capabilities.
Which cmake version to upgrade to ? Ideally it would be good to support 3.1.0 as minimum version, and conditionally include any feature required from higher version:
cmake_minimum_required(VERSION 3.1.0)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12")
...
endif()
Can I ask so that when we implement this, we can specify what versions of Android deps to use via env vars. My team needs this layer to be compatible with certain versions of NDK and SDK.. I wonder if we can use something like this:
export SDKAPILevelOverride=android-28
export NDKAPILevelOverride=latest
or what not. Similar how it's handled in Unreal Engine. It's a moving target for us.
For SDK level there is an option to overlay default config with custom tools.gradle.user
file
I think app which depends on the lib upgrades a library defined target sdk, lowering target sdk can cause unpredictable behavior
Regarding NDK, There is a default NDK mapping between Gradle plugin and NDK
NDK version can be overridden via ANDROID_NDK_VERSION
env variable
Regarding cmake
, current version is 3.10, but there is a warning
CMake Warning at /Users/algavris/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
An old version of CMake is being used that cannot automatically detect
compiler attributes. Compiler identification is being bypassed. Some
values may be wrong or missing. Update to CMake 3.19 or newer to use
CMake's built-in compiler identification.