Closed linsui closed 2 weeks ago
Hello @linsui.
Thanks for creating this issue.
We just pushed a new script in ./scripts/build-bitbox-bridge.sh
, that does everything: clone the corresponding repo, build the .aar
and copies it in the android/app/libs
folder.
This script requires docker to be installed to function correctly.
Let me know if you can use it!
Nope, but maybe it's scripts can be ported to plain Debian?
Isn't it a simple gomobile build? Why do we need to use docker here? Since the build step is pretty simple, we don't need the script. We just need to know which commit we should build the aar against. Please pin the hash somewhere, maybe in a file in https://github.com/SwissBitcoinPay/app/tree/main/android/app/libs.
Ok, then if using gomobile
is easier than using docker on your build machines, you can build it directly using gomobile.
I added a BITBOX_BRIDGE_COMMIT
file in https://github.com/SwissBitcoinPay/app/tree/main/android/app/libs, which you can use to pull our repo using:
ORG="SwissBitcoinPay"
REPO="bitbox-wallet-app"
BITBOX_BRIDGE_COMMIT=$(cat ./android/app/libs/BITBOX_BRIDGE_COMMIT)
git clone --depth 1 https://github.com/$ORG/$REPO.git
cd $REPO
git fetch origin $BITBOX_BRIDGE_COMMIT
git checkout $BITBOX_BRIDGE_COMMIT
Feel free to adapt it, or let me know if you need something else!
This is what I run
- pushd $$bitbox-wallet-app$$
- go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20241108191957-fa514ef75a0f
- go mod download
- gomobile init
- gomobile bind -x -a -ldflags="-s -w" -target "android/amd64" -o mobileserver.aar
-androidapi 24 ./backend/mobileserver/
- popd
but it failed with
gomobile: go mod tidy failed: exit status 1
go: error reading go.mod: missing module declaration. To specify the module path:
go mod edit -module=example.com/mod
Any idea?
I also saw other errors when running the command in the makefile
+ gomobile bind -x -a -glflags=-mod=readonly '-ldflags=-s -w' -target android/arm .
flag provided but not defined: -glflags
+ gomobile bind -x -a '-ldflags=-s -w' -target android/arm .
GOMOBILE=/home/vagrant/build/srclib/go/pkg/gomobile
WORK=/tmp/gomobile-work-3883656036
rm -r -f "$WORK"
gomobile: ANDROID_NDK_HOME specifies /opt/android-sdk/ndk/25.1.8937393, which is unusable: unsupported API version 16 (not in 19..33)
@linsui I'm not a go expert and it's not our own package, but maybe running make envinit
at the root level (or running the same commands) might fix it? Seems something's not initialized.
Thanks!
An aar is added in https://github.com/SwissBitcoinPay/app/pull/131. F-Droid needs to build it from source. Where is the source code? How can we build it?