Skip to content

Android gradle9 pin barcode scanner and its deps - #10846

Open
accumulator wants to merge 5 commits into
spesmilo:masterfrom
accumulator:android_gradle9_pin_barcode_scanner
Open

Android gradle9 pin barcode scanner and its deps#10846
accumulator wants to merge 5 commits into
spesmilo:masterfrom
accumulator:android_gradle9_pin_barcode_scanner

Conversation

@accumulator

@accumulator accumulator commented Aug 12, 2026

Copy link
Copy Markdown
Member

This PR upgrades gradle used in P4A to 9.4.1 (AGP 9.1.0) and patches the barcode scanner components
to pin to the p4a provided toolchain, upgrades xzing-cpp to 3.1.0.0, CameraView to 1.10.2

Comment thread contrib/android/Dockerfile Outdated
@accumulator
accumulator force-pushed the android_gradle9_pin_barcode_scanner branch 2 times, most recently from 7d7c8f2 to 94c3bba Compare August 12, 2026 14:59
@accumulator
accumulator force-pushed the android_gradle9_pin_barcode_scanner branch 4 times, most recently from 657b898 to 53f0ddf Compare August 17, 2026 09:30
- pin toolchain to container provided toolchain for BarcodeScannerView, CameraView and zxing-cpp
- explicitly pin CMake in make_barcode_scanner.sh
- this requires patching the checked out sources
- upgrade zxing-cpp to 3.1.0.0
- upgrade CameraView to 1.10.2  (fixes potential NPE on visibiity change)
- call all gradle builds with android.builder.sdkDownload=false to force use of pinned SDK, fail otherwise.
- pin gradle itself using distributionSha256Sum

Note: since gradle now refuses to use other SDKs than the one provided by P4A, the patches need
(probably slight) maintenance when buildozer SDK is updated.
@accumulator
accumulator force-pushed the android_gradle9_pin_barcode_scanner branch from 53f0ddf to 8590849 Compare August 17, 2026 11:49
… and zxing-cpp, pinning

the dependency trees of these modules.

also adds metadata generation script make_verification_metadata.sh, which should be run
from within the build container.
@accumulator accumulator changed the title [dont-merge] Android gradle9 pin barcode scanner Android gradle9 pin barcode scanner and its deps Aug 17, 2026
CAMERA_VIEW_VERSION="1.10.2"

ZXING_CPP_COMMIT_HASH="79f5adc6250e90de0bd635eb9181c5f8a18affda" # v2.3.0.4 using kotlin-stdlib 1.8.22
ZXING_CPP_COMMIT_HASH="e88bb1d9e43502ad7073d29ee72cea4b758c1125" # v3.1.0.0 using kotlin-stdlib 2.2.10

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if markusfisch/zxing-cpp now uses gradle 9, can we then use use Java 21 (or 25) and undo the hacks in 4da7b7f (from #10452)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

probably, but will need to test.

Comment on lines 170 to +172
android.gradle_dependencies =
androidx.core:core:1.16.0,
org.jetbrains.kotlin:kotlin-stdlib:1.8.22
org.jetbrains.kotlin:kotlin-stdlib:2.2.10

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How come all the verification-metadata xml files are for the QR scanner? I would have expected some java deps to be pulled in through python-for-android, for the main Electrum code. For example, what about this androidx.core? How come that's not pinned in an xml file? Does gradle not download that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How come all the verification-metadata xml files are for the QR scanner? I would have expected some java deps to be pulled in through python-for-android, for the main Electrum code. For example, what about this androidx.core? How come that's not pinned in an xml file? Does gradle not download that?

The QR scanner was the scope for this PR, pinning the dependencies above probably needs additional changes in our P4A fork.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How many more dependencies would that represent? (the ones that are not pinned yet)

@SomberNight SomberNight Aug 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is madness. Are all these transitive deps really pulled in only for the QR scanner? 500+ deps. Completely unrealistic to vet/review. Thanks a lot for looking into pinning this -- without that I would not have realised we are apparently pulling in the world...

If we tried to switch to your PoC QtMultimedia scanner, could we drop all these?
(Maybe since switching to Qt 6.10, it would no longer be crashing?)

@accumulator accumulator Aug 20, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is madness. Are all these transitive deps really pulled in only for the QR scanner? 500+ deps. Completely unrealistic to vet/review. Thanks a lot for looking into pinning this -- without that I would not have realised we are apparently pulling in the world...

Agreed, it feels a bit.. fragile. I was in doubt whether to include the last commit in this PR for the same reasons, but on the other hand, what's the use of pinning only the top of the dep hierarchy..

If we tried to switch to your PoC QtMultimedia scanner, could we drop all these? (Maybe since switching to Qt 6.10, it would no longer be crashing?)

Yes. However, the last time I dug into this, I saw there were some patches upstream around Qt6.6-6.8 claiming to fix some stability problems with it. No idea if it's stable now, at least it seemed to received some eyeballs.

Note that there were issues on Android8 w.r.t QtMultimedia (don't remember exactly what, likely a NPE/SEGV at init) and was disabled in spesmilo/python-for-android@375a05d

BTW, It wasn't really a PoC scanner, it was the implementation we used while on Qt5.

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.

3 participants