Android: signed, smaller release APKs

Release builds now come out one APK per ABI, signed from a gitignored
keystore.properties. Oboe is built from source with libopus and a static
libc++ into the one native library, which exports only its JNI entry
points; dex and native code are compressed in the APK and library
translations dropped. The arm64 APK went from 11.6 MB to 5.5 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 12:23:09 +00:00
co-authored by Claude Opus 5.5
parent 44ecc15bd8
commit 55e8b7bccb
5 changed files with 58 additions and 15 deletions
+14 -5
View File
@@ -3,10 +3,12 @@ project(ts3audio LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
find_package(oboe REQUIRED CONFIG)
# libopus from its release tarball, built static into our one library.
# Oboe and libopus from source, built static into our one library together with a static
# libc++, so the app ships a single small .so per ABI.
include(FetchContent)
FetchContent_Declare(oboe
URL https://github.com/google/oboe/archive/refs/tags/1.11.0.tar.gz
URL_HASH SHA256=0ccf2110640a2b4489f1c93a404f2978656b434d8c5dc9cb6258f9cc95c79b15)
FetchContent_Declare(opus
URL https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
URL_HASH SHA256=65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1)
@@ -15,8 +17,15 @@ set(OPUS_BUILD_TESTING OFF CACHE BOOL "" FORCE)
set(OPUS_BUILD_SHARED_LIBRARY OFF CACHE BOOL "" FORCE)
set(OPUS_INSTALL_PKG_CONFIG_MODULE OFF CACHE BOOL "" FORCE)
set(OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(opus)
FetchContent_MakeAvailable(oboe opus)
add_library(ts3audio SHARED audio_line.cpp opus_jni.cpp)
target_link_libraries(ts3audio PRIVATE oboe::oboe opus log)
target_link_libraries(ts3audio PRIVATE oboe opus log)
target_compile_options(ts3audio PRIVATE -Wall -Wextra)
# Only the JNI entry points are exported; everything else may be dropped.
set_target_properties(ts3audio PROPERTIES CXX_VISIBILITY_PRESET hidden C_VISIBILITY_PRESET hidden)
foreach(lib oboe opus)
target_compile_options(${lib} PRIVATE -ffunction-sections -fdata-sections)
endforeach()
target_link_options(ts3audio PRIVATE -Wl,--gc-sections -Wl,--exclude-libs,ALL)