diff --git a/scripts/android/cmake_android.sh b/scripts/android/cmake_android.sh index 2ceeecb47..643d016a5 100755 --- a/scripts/android/cmake_android.sh +++ b/scripts/android/cmake_android.sh @@ -10,7 +10,8 @@ ANDROID_NDK_VERSION="${ANDROID_NDK_VERSION:2}" # ANDROID_NDK_HOME must be exported for cargo-ndk export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION" -ANDROID_API_LEVEL=34 +# ANDROID_API_LEVEL must specify the _minimum_ supported SDK version, otherwise this will cause linking errors at launch +ANDROID_API_LEVEL=24 ANDROID_SUB_BUILD_DIR=build_arch COLOR_RED="\e[1;31m" diff --git a/scripts/android/files/build.gradle b/scripts/android/files/build.gradle index e0090e7d0..cc1a53904 100644 --- a/scripts/android/files/build.gradle +++ b/scripts/android/files/build.gradle @@ -21,7 +21,7 @@ android { defaultConfig { applicationId "org.ddnet.client" namespace("org.ddnet.client") - minSdkVersion 19 + minSdkVersion 24 targetSdkVersion 34 versionCode TW_VERSION_CODE versionName "TW_VERSION_NAME" diff --git a/scripts/compile_libs/cmake_lib_compile.sh b/scripts/compile_libs/cmake_lib_compile.sh index 775584e11..72c3ee741 100755 --- a/scripts/compile_libs/cmake_lib_compile.sh +++ b/scripts/compile_libs/cmake_lib_compile.sh @@ -29,6 +29,8 @@ function compile_source_android() { -DCMAKE_SYSTEM_NAME=Android \ -DCMAKE_SYSTEM_VERSION="$1" \ -DCMAKE_ANDROID_ARCH_ABI="${3}" \ + -DCMAKE_C_FLAGS="$COMPILEFLAGS" -DCMAKE_CXX_FLAGS="$COMPILEFLAGS" -DCMAKE_CXX_FLAGS_RELEASE="$COMPILEFLAGS" -DCMAKE_C_FLAGS_RELEASE="$COMPILEFLAGS" \ + -DCMAKE_SHARED_LINKER_FLAGS="$LINKFLAGS" -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$LINKFLAGS" \ -B"$2" \ -DBUILD_SHARED_LIBS=OFF \ -DHIDAPI_SKIP_LIBUSB=TRUE \ diff --git a/scripts/compile_libs/gen_libs.sh b/scripts/compile_libs/gen_libs.sh index e9a6436bc..9ba0a460b 100755 --- a/scripts/compile_libs/gen_libs.sh +++ b/scripts/compile_libs/gen_libs.sh @@ -46,7 +46,8 @@ fi mkdir -p "$1" cd "$1" || exit 1 -_ANDROID_ABI_LEVEL=34 +# ANDROID_API_LEVEL must specify the _minimum_ supported SDK version, otherwise this will cause linking errors at launch +ANDROID_API_LEVEL=24 function build_cmake_lib() { if [ ! -d "${1}" ]; then @@ -59,7 +60,7 @@ function build_cmake_lib() { ( cd "${1}" || exit 1 cp "${CURDIR}"/scripts/compile_libs/cmake_lib_compile.sh cmake_lib_compile.sh - ./cmake_lib_compile.sh "$_ANDROID_ABI_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS" + ./cmake_lib_compile.sh "$ANDROID_API_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS" ) } @@ -74,7 +75,7 @@ cd compile_libs || exit 1 ( cd openssl || exit 1 cp "${CURDIR}"/scripts/compile_libs/make_lib_openssl.sh make_lib_openssl.sh - ./make_lib_openssl.sh "$_ANDROID_ABI_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS" + ./make_lib_openssl.sh "$ANDROID_API_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS" ) ) @@ -97,7 +98,7 @@ build_cmake_lib opus https://github.com/xiph/opus ./autogen.sh fi cp "${CURDIR}"/scripts/compile_libs/make_lib_opusfile.sh make_lib_opusfile.sh - ./make_lib_opusfile.sh "$_ANDROID_ABI_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS" + ./make_lib_opusfile.sh "$ANDROID_API_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS" ) # SQLite, just download and built by hand @@ -109,7 +110,7 @@ fi ( cd sqlite3 || exit 1 cp "${CURDIR}"/scripts/compile_libs/make_lib_sqlite3.sh make_lib_sqlite3.sh - ./make_lib_sqlite3.sh "$_ANDROID_ABI_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS" + ./make_lib_sqlite3.sh "$ANDROID_API_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS" ) cd ..