Kivy based brain trainer
This repository is there for demonstration purposes mainly. You could possibly experience some weird issues while getting it running on your platform. Star and fork the repository if you want to say thank you.
Download the app on google play:
Install kivy. Install audio and video deps too.
Create using the system site packages.
mkvirtualenv --system-site-packages kognitivo
pip install -r requirements.txt
Create static files
- create atlas:
- update translation files:
- create translation files:
- fill the database with fake data:
- test with:
KIVY_UNITTEST=true pytest. Use pytest xdist in order to start in multiprocess mode:
KIVY_UNITTEST=true pytest -n 4. Use keyword
<lang_code>_langto execute the tests for a certain language only:
KIVY_UNITTEST=true pytest -n 4 -k en_lang.
Packaging for android
Make sure you've gone all steps in kivy packing guide
Install and setup buildozer
Buildozer is python android packaging tool. Because of python for android won't work inside the virtualenv it must be installed within global python env. Make sure you go through installation instructions
- Install buildozer globally
sudo pip install buildozer==0.33. Make sure you are not in the virtualenv.
- Install android SDK and NDK with
buildozer android update. This may take a while. Make sure you are not in the virtualenv.
- Locate location of SDK. Normally at
- Set sdk path in
invoke.jsoninplace of <SET_SDK_PATH>. Verify with
inv android.managerwhich starts sdk manager GUI.
Packaging in DEBUG mode
inv android.debug --no-deploy. This one is a wrapper around
buildozer debugwith a custom patching of the android project usually located at
- APK built in DEBUG mode will be placed in
bin/directory named like
Packaging in RELEASE mode
The following instructions are there for you as example of how you could release-ready package your own app.
Of course you can be a total jerk and just upload the copy of kognitivo into Google Play, it's your choice.
- First you'd need to have a keystore. This is a nice and short write up
- Place it in
- Set your keystore password inplace of
inv android.release --no-deploy. It's not much different from the bare
buildozer android release, only android project files patching.
Using android emulator
- Start manager GUI with:
- Install ARM EABI image: Android 5.1.1 -> ARM EABI v7a System Image
- Start emulators manager with:
- Create a device, pick just created ARM EABI system image, set GPU acceleration, set VM Heap size min to 512 MB
- Note that the emulator performance is way worse, than on the real device, so it takes very long for the app to start
Not recommended didn't work for me: Genymotion uses Virtual Box x86 based images, new p4a toolchain seems to have massive problems with x86
Genymotion is a powerful android emulator free for personal use. Genymotion uses virtualbox, so make sure you've done installation guide
- Download genymotion installation binary
- Move the binary downloaded to a directory you want genymotion to live
- Make the binary executable with chmod +x, execute it
- Copy invoke.json.template to invoke.json (will be ignored), set genymotion path inplace of
- Verify genymotion path is found with
inv android.check-genymotion, it should show:
- Start genymotion from your OS GUI or from command line with
<genymotion>/genymotion. Go through the wizard and install a device you wish. Let's say it will be Google Pixel with Android 7.0. Could find gapps for 7.1, see below.
- Set the android sdk path to the one from kivy from genymotion GUI(Settings->ADB->Use custom Android SDK tools) to
your sdk path. We've just found it recently and put in
- Download ARM translation ZIP, drag-and-drop it inside the emulator's window, wait a while, click yes and yes.
- todo: Install gapps fitting your device
Starting the emulator
VBoxManage list vms, find the device id in the list of installed virtual boxes. It's the on in curly braces like
- Put the device_id in
- Start the specified emulator with:
Install and run in emulator
install debug version in the emulator with
inv android.install --debug. It would use a debug apk with the biggest version in
usually while development you'd want to do package and run your app, you can do so by dropping
inv android.debug. This would start an emulator, install the apk and run the app. You can also add
--logcatoption in order to see the logs in your command line. Stop with Ctrl+C
ImportError: Cython.Distutils-> install cython
apt install cython
- GL headers missing, install mesa headers:
apt install libgl1-mesa-dev
pkg_resources.VersionConflict: (pytest 2.8.7 (/usr/lib/python2.7/dist-packages), Requirement.parse('pytest>=3.0.0'))-> you have pytest installed globally, remove it and reinstall pytest in the virtualenv
- Buildozer complains about missing java compiler
Java compiler (javac) not found, please install it.. -> Install missing jdk. For openjdk and java 8:
sudo apt install openjdk-8-jdk
- Sometimes logger buildozer or p4a would fail with messages containing some random unicode letters. Know it's because your system locale is not english
Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]while installing the app inside the emulator -> caused by the fact that genymotion emulators are based on the x86 architecture, you've probably forgotten to install ARM translation
- first run of
inv android.debugcould possibly fail with missing string ids (app_id and facebook_app_id). Just rerun the the commands. This is happening because patching fails if there is no project directory yet.
cannot create GLES surface-> emulator doesn't have
use host GPUcheckbox
If you are still willing to contribute, just make a PR, run the tests and
flake8 on your branch. I'll take a look :D