Readme.md (3785B)
1 # Kivy GUI 2 3 The Kivy GUI is used with Electrum on Android devices. 4 To generate an APK file, follow these instructions. 5 6 ## Android binary with Docker 7 8 ✗ _This script does not produce reproducible output (yet!). 9 Please help us remedy this._ 10 11 This assumes an Ubuntu (x86_64) host, but it should not be too hard to adapt to another 12 similar system. The docker commands should be executed in the project's root 13 folder. 14 15 1. Install Docker 16 17 ``` 18 $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 19 $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 20 $ sudo apt-get update 21 $ sudo apt-get install -y docker-ce 22 ``` 23 24 2. Build image 25 26 ``` 27 $ sudo docker build -t electrum-android-builder-img contrib/android 28 ``` 29 30 3. Build locale files 31 32 ``` 33 $ ./contrib/pull_locale 34 ``` 35 36 4. Prepare pure python dependencies 37 38 ``` 39 $ ./contrib/make_packages 40 ``` 41 42 5. Build binaries 43 44 ``` 45 $ mkdir --parents $PWD/.buildozer/.gradle 46 $ sudo docker run -it --rm \ 47 --name electrum-android-builder-cont \ 48 -v $PWD:/home/user/wspace/electrum \ 49 -v $PWD/.buildozer/.gradle:/home/user/.gradle \ 50 -v ~/.keystore:/home/user/.keystore \ 51 --workdir /home/user/wspace/electrum \ 52 electrum-android-builder-img \ 53 ./contrib/android/make_apk 54 ``` 55 This mounts the project dir inside the container, 56 and so the modifications will affect it, e.g. `.buildozer` folder 57 will be created. 58 59 5. The generated binary is in `./bin`. 60 61 62 63 ## FAQ 64 65 ### I changed something but I don't see any differences on the phone. What did I do wrong? 66 You probably need to clear the cache: `rm -rf .buildozer/android/platform/build-*/{build,dists}` 67 68 69 ### How do I deploy on connected phone for quick testing? 70 Assuming `adb` is installed: 71 ``` 72 $ adb -d install -r bin/Electrum-*-arm64-v8a-debug.apk 73 $ adb shell monkey -p org.electrum.electrum 1 74 ``` 75 76 77 ### How do I get an interactive shell inside docker? 78 ``` 79 $ sudo docker run -it --rm \ 80 -v $PWD:/home/user/wspace/electrum \ 81 -v $PWD/.buildozer/.gradle:/home/user/.gradle \ 82 --workdir /home/user/wspace/electrum \ 83 electrum-android-builder-img 84 ``` 85 86 87 ### How do I get more verbose logs for the build? 88 See `log_level` in `buildozer.spec` 89 90 91 ### How can I see logs at runtime? 92 This should work OK for most scenarios: 93 ``` 94 adb logcat | grep python 95 ``` 96 Better `grep` but fragile because of `cut`: 97 ``` 98 adb logcat | grep -F "`adb shell ps | grep org.electrum.electrum | cut -c14-19`" 99 ``` 100 101 102 ### Kivy can be run directly on Linux Desktop. How? 103 Install Kivy. 104 105 Build atlas: `(cd contrib/android/; make theming)` 106 107 Run electrum with the `-g` switch: `electrum -g kivy` 108 109 ### debug vs release build 110 If you just follow the instructions above, you will build the apk 111 in debug mode. The most notable difference is that the apk will be 112 signed using a debug keystore. If you are planning to upload 113 what you build to e.g. the Play Store, you should create your own 114 keystore, back it up safely, and run `./contrib/make_apk release`. 115 116 See e.g. [kivy wiki](https://github.com/kivy/kivy/wiki/Creating-a-Release-APK) 117 and [android dev docs](https://developer.android.com/studio/build/building-cmdline#sign_cmdline). 118 119 ### Access datadir on Android from desktop (e.g. to copy wallet file) 120 Note that this only works for debug builds! Otherwise the security model 121 of Android does not let you access the internal storage of an app without root. 122 (See [this](https://stackoverflow.com/q/9017073)) 123 ``` 124 $ adb shell 125 $ run-as org.electrum.electrum ls /data/data/org.electrum.electrum/files/data 126 $ run-as org.electrum.electrum cp /data/data/org.electrum.electrum/files/data/wallets/my_wallet /sdcard/some_path/my_wallet 127 ```