URI: 
       tupdate kivy readme - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 7c6364c2c7502cf25df88152cc4464c5ce6819eb
   DIR parent e523b657675ffeb2013de898acb7524a0537fefe
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Mon,  7 May 2018 17:46:13 +0200
       
       update kivy readme
       
       Diffstat:
         M gui/kivy/Readme.md                  |      98 ++++++++++++++++++++++++-------
       
       1 file changed, 77 insertions(+), 21 deletions(-)
       ---
   DIR diff --git a/gui/kivy/Readme.md b/gui/kivy/Readme.md
       t@@ -2,12 +2,29 @@
        
        The Kivy GUI is used with Electrum on Android devices. To generate an APK file, follow these instructions.
        
       -## 1. Install python-for-android (p4a)
       +## 1. Preliminaries
       +
       +Make sure the current user can write `/opt` (e.g. `sudo chown username: /opt`).
       +
       +We assume that you already got Electrum to run from source on this machine,
       +hence have e.g. `git`, `python3-pip` and `python3-setuptools`.
       +
       +## 2. Install kivy
       +
       +Install kivy for python3 as described [here](https://kivy.org/docs/installation/installation-linux.html).
       +So for example:
       +```sh
       +sudo add-apt-repository ppa:kivy-team/kivy
       +sudo apt-get install python3-kivy
       +```
       +
       +
       +## 3. Install python-for-android (p4a)
        p4a is used to package Electrum, Python, SDL and a bootstrap Java app into an APK file. 
        We patched p4a to add some functionality we need for Electrum. Until those changes are
        merged into p4a, you need to merge them locally (into the master branch):
        
       -1.1 [kivy/python-for-android#1217](https://github.com/kivy/python-for-android/pull/1217)
       +3.1 [kivy/python-for-android#1217](https://github.com/kivy/python-for-android/pull/1217)
        
        Something like this should work:
        
       t@@ -21,8 +38,8 @@ git checkout 93759f36ba45c7bbe0456a4b3e6788622924cbac
        git merge a2fb5ecbc09c4847adbcfd03c6b1ca62b3d09b8d
        ```
        
       -## 2. Install buildozer
       -2.1 Buildozer is a frontend to p4a. Luckily we don't need to patch it:
       +## 4. Install buildozer
       +4.1 Buildozer is a frontend to p4a. Luckily we don't need to patch it:
        
        ```sh
        cd /opt
       t@@ -31,42 +48,81 @@ cd buildozer
        sudo python3 setup.py install
        ```
        
       -2.2 Download the [Crystax NDK](https://www.crystax.net/en/download) manually.
       +4.2 Install additional dependencies:
       +```sh
       +sudo apt-get install python-pip
       +```
       +and the ones listed
       +[here](https://buildozer.readthedocs.io/en/latest/installation.html#targeting-android).
       +
       +You will also need
       +```sh
       +python3 -m pip install colorama appdirs sh jinja2
       +```
       +
       +
       +4.3 Download the [Crystax NDK](https://www.crystax.net/en/download) manually.
        Extract into `/opt/crystax-ndk-10.3.2`
        
       -## 3. Update the Android SDK build tools
        
       -### Method 1: Using the GUI
       +## 5. Create the UI Atlas
       +In the `gui/kivy` directory of Electrum, run `make theming`.
        
       -  Start the Android SDK manager in GUI mode:
       +## 6. Download Electrum dependencies
       +```sh
       +sudo contrib/make_packages
       +```
       +
       +## 7. Try building the APK and fail
       +
       +```sh
       +contrib/make_apk
       +```
       +
       +During this build attempt, buildozer downloaded some tools,
       +e.g. those needed in the next step.
       +
       +## 8. Update the Android SDK build tools
        
       -      ~/.buildozer/android/platform/android-sdk-20/tools/android
       +### Method 1: Using the GUI
        
       -  Check the latest SDK available and install it.
       -  Close the SDK manager.
       -  Reopen the SDK manager, scroll to the bottom and install the latest build tools (probably v27)
       -  Install "Android Support Library Repository" from the SDK manager.
       +  Start the Android SDK manager in GUI mode:
       +  
       +    ~/.buildozer/android/platform/android-sdk-20/tools/android
       +
       +  Check the latest SDK available and install it
       +  ("Android SDK Tools" and "Android SDK Platform-tools").
       +  Close the SDK manager. Repeat until there is no newer version.
       +  
       +  Reopen the SDK manager, and install the latest build tools
       +  ("Android SDK Build-tools"), 27.0.3 at the time of writing.
       +  
       +  Install "Android Support Repository" from the SDK manager (under "Extras").
        
        ### Method 2: Using the command line:
        
          Repeat the following command until there is nothing to install:
        
       -      ~/.buildozer/android/platform/android-sdk-20/tools/android update sdk -u -t tools,platform-tools
       +    ~/.buildozer/android/platform/android-sdk-20/tools/android update sdk -u -t tools,platform-tools
        
          Install Build Tools, android API 19 and Android Support Library:
        
       -      ~/.buildozer/android/platform/android-sdk-20/tools/android update sdk -u -t build-tools-27.0.3,android-19,extra-android-m2repository
       +    ~/.buildozer/android/platform/android-sdk-20/tools/android update sdk -u -t build-tools-27.0.3,android-19,extra-android-m2repository
        
        
       +## 9. Set apk version
        
       -## 5. Create the UI Atlas
       -In the `gui/kivy` directory of Electrum, run `make theming`.
       +Create a file `contrib/versions.py` with contents similar to:
       +```
       +version_apk = '3.1.999' 
       +```
       +This will be the version of the Android app.
        
       -## 6. Download Electrum dependencies
       -Run `contrib/make_packages`.
       +## 10. Build the APK
        
       -## 7. Build the APK
       -Run `contrib/make_apk`.
       +```sh
       +contrib/make_apk
       +```
        
        # FAQ
        ## Why do I get errors like `package me.dm7.barcodescanner.zxing does not exist` while compiling?