The Kivy GUI is used with Electrum on Android devices. To generate an APK file, follow these instructions.
✗ This script does not produce reproducible output (yet!). Please help us remedy this.
This assumes an Ubuntu (x86_64) host, but it should not be too hard to adapt to another similar system. The docker commands should be executed in the project's root folder.
-
Install Docker
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo apt-get update $ sudo apt-get install -y docker-ce -
Build image
$ sudo docker build -t electrum-android-builder-img electrum/gui/kivy/tools -
Build locale files
$ ./contrib/pull_locale -
Prepare pure python dependencies
$ ./contrib/make_packages -
Build binaries
$ mkdir --parents $PWD/.buildozer/.gradle $ sudo docker run -it --rm \ --name electrum-android-builder-cont \ -v $PWD:/home/user/wspace/electrum \ -v $PWD/.buildozer/.gradle:/home/user/.gradle \ -v ~/.keystore:/home/user/.keystore \ --workdir /home/user/wspace/electrum \ electrum-android-builder-img \ ./contrib/make_apkThis mounts the project dir inside the container, and so the modifications will affect it, e.g.
.buildozerfolder will be created. -
The generated binary is in
./bin.
You probably need to clear the cache: rm -rf .buildozer/android/platform/build/{build,dists}
Assuming adb is installed:
$ adb -d install -r bin/Electrum-*-arm64-v8a-debug.apk
$ adb shell monkey -p org.electrum.electrum 1
$ sudo docker run -it --rm \
-v $PWD:/home/user/wspace/electrum \
-v $PWD/.buildozer/.gradle:/home/user/.gradle \
--workdir /home/user/wspace/electrum \
electrum-android-builder-img
See log_level in buildozer.spec
This should work OK for most scenarios:
adb logcat | grep python
Better grep but fragile because of cut:
adb logcat | grep -F "`adb shell ps | grep org.electrum.electrum | cut -c14-19`"
Install Kivy.
Build atlas: (cd electrum/gui/kivy/; make theming)
Run electrum with the -g switch: electrum -g kivy
If you just follow the instructions above, you will build the apk
in debug mode. The most notable difference is that the apk will be
signed using a debug keystore. If you are planning to upload
what you build to e.g. the Play Store, you should create your own
keystore, back it up safely, and run ./contrib/make_apk release.
See e.g. kivy wiki and android dev docs.