Skip to content

fix(scanner): stop packaging the unused OpenCV Java library - #1604

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/drop-unused-opencv-so
Sep 28, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/drop-unused-opencv-so

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

The release APK is 267 MB, and 130 MB of that is libopencv_java4.so for four ABIs (22 MB on arm64). Nothing loads it.

The scanner's CMake links OpenCV statically. The Android SDK's OpenCVConfig.cmake sets OpenCV_SHARED OFF, and find_package reads it straight from vendor/opencv/sdk/native, so the native build never needed the Gradle dependency. The only thing implementation(project(":vendor:opencv:sdk")) did was put the SDK's prebuilt libopencv_java4.so into the APK.

In the arm64 release build:

  • libcodeScanner.so defines 1,642 cv:: symbols and leaves none undefined. It has no NEEDED entry for libopencv_java4.so, and libkikCodes.so needs only libcodeScanner.so.
  • No other native lib contains the string opencv_java. libcodeScanner.so does import dlopen, but every library name in it belongs to OpenCV's optional TBB, VTune and parallel-plugin hooks. None of those ships in the APK today.
  • The release dex has no org/opencv references, and outside vendor/opencv/ no code uses org.opencv or OpenCVLoader.

libc++_shared.so, about 1 MB per ABI, leaves with it: libopencv_java4.so was the only library that needed it.

Play installs are smaller by the arm64 slice. The universal APK that build_flipcash builds with bundletool loses the full 130 MB.

:vendor:opencv:sdk is still in settings.gradle.kts and the OpenCV Gradle plugin is still on the root classpath. Both can go in a follow-up, but the native/ files have to stay because CMake reads them.

libcodeScanner.so links OpenCV statically, so nothing loads
libopencv_java4.so. The :vendor:opencv:sdk dependency only put that
library, about 130 MB across four ABIs, into the APK.
@bmc08gt bmc08gt self-assigned this Sep 28, 2026
@github-actions github-actions Bot added area: scanner QR/Kikcode scanning, camera type: fix Bug fix labels Sep 28, 2026
@bmc08gt
bmc08gt merged commit dd25a5b into code/cash Sep 28, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the fix/drop-unused-opencv-so branch September 28, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: scanner QR/Kikcode scanning, camera type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant