kivy_buildozer
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
kivy_2020_hello_world [2019/12/19 10:59] – [openjdk 11 vs 8] serge | kivy_buildozer [2022/09/14 09:39] (Version actuelle) – [Venv] serge | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== Kivy 2020: Buildozer pour compiler une application Android en python ====== | + | ====== Kivy: Buildozer pour compiler une application Android en python ====== |
<WRAP center round box 60% centeralign> | <WRAP center round box 60% centeralign> | ||
- | **... {{tagpage> | + | **{{tagpage> |
- | **... {{tagpage> | + | **[[http:// |
- | **...** | + | </ |
+ | <WRAP center round box 40% centeralign> | ||
+ | **[[les_pages_kivy_en_details|Les pages Kivy en détails]]** | ||
</ | </ | ||
- | |||
<WRAP center round box 60% centeralign> | <WRAP center round box 60% centeralign> | ||
- | **[[http:// | + | **Generic Python packager for Android and iOS** |
</ | </ | ||
- | =====Le programme python kivy===== | + | =====Ressources===== |
+ | * **[[https:// | ||
+ | * **[[https:// | ||
+ | |||
+ | |||
+ | =====Utilisation sur Debian 11 Bullseye===== | ||
+ | ====Dépendances==== | ||
+ | sudo apt install libsdl2-dev zlib1g-dev pkg-config autoconf automake cmake dkms libtool libsdl2-2.0-0 ccache unzip ffmpeg libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libswscale-dev libncurses5: | ||
+ | |||
+ | ===OpenJDK=== | ||
+ | Pour connaître votre version actuelle | ||
+ | java -version | ||
+ | |||
+ | Pour avoir la liste des versions installées | ||
+ | sudo update-java-alternatives --list | ||
+ | |||
+ | Pour changer de version | ||
+ | sudo update-alternatives --config java | ||
+ | |||
+ | Il faut la version 11 | ||
+ | sudo apt install openjdk-11-jdk openjdk-11-source | ||
+ | ====Venv==== | ||
+ | **C' | ||
+ | Dans le dossier du venv existant: | ||
+ | <code bash> | ||
+ | source mon_env/ | ||
+ | python3 -m pip install buildozer setuptools cython | ||
+ | buildozer init | ||
+ | |||
+ | File buildozer.spec created, ready to customize! | ||
+ | |||
+ | toto@debian:/ | ||
+ | (mon_env) toto@debian:/ | ||
+ | |||
+ | (mon_env) toto@debian:/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | =====Le programme python kivy Hello world===== | ||
+ | |||
+ | * **[[https:// | ||
<file python hello_world.py> | <file python hello_world.py> | ||
#! / | #! / | ||
Ligne 31: | Ligne 73: | ||
=====Compilation avec Buildozer===== | =====Compilation avec Buildozer===== | ||
La page plus ancienne **Kivy Comment créer une application android en python** est en [[archives/ | La page plus ancienne **Kivy Comment créer une application android en python** est en [[archives/ | ||
- | ====Instalation==== | + | ====Installation==== |
- | + | Des ressources suffisantes mais peut-être pas necéssaires ! | |
<code text> | <code text> | ||
Ligne 44: | Ligne 85: | ||
sudo pip3 install pygame kivy buildozer pyjnius | sudo pip3 install pygame kivy buildozer pyjnius | ||
</ | </ | ||
- | =====openjdk 11 vs 8===== | ||
- | Ce problème se retrouve identiquement sur une Xubuntu18.04 ! | + | =====Utilisation===== |
+ | Le fichier principal qui lance kivy doit s' | ||
+ | |||
+ | Dans le dossier du projet: | ||
+ | buildozer init | ||
+ | crée le fichier buildozer.spec | ||
+ | |||
+ | ====buildozer.spec==== | ||
+ | Il faut définir | ||
+ | |||
+ | ===Le buildozer.spec du hello world=== | ||
+ | <code python> | ||
+ | [app] | ||
+ | title = My Application | ||
+ | package.name = myapp | ||
+ | package.domain = org.test | ||
+ | source.dir = . | ||
+ | source.include_exts = py, | ||
+ | version = 0.14 | ||
+ | requirements = python3, | ||
+ | orientation = portrait | ||
+ | fullscreen = 0 | ||
+ | android.arch = armeabi-v7a | ||
+ | |||
+ | [buildozer] | ||
+ | log_level = 2 | ||
+ | warn_on_root = 1 | ||
+ | </ | ||
+ | === Version Méthode 1 === | ||
+ | Cette ligne doit être la première ligne de code du fichier main.py; les versions seront gérées dans ce fichier. | ||
+ | < | ||
< | < | ||
+ | # (str) Application versioning (method 1) | ||
+ | version.regex = __version__ = ['" | ||
+ | version.filename = %(source.dir)s/ | ||
+ | # (str) Application versioning (method 2) | ||
+ | # version = 1.2.0 | ||
</ | </ | ||
- | * Aucunes des solutions proposées par **https://github.com/kivy/buildozer/issues/862** ne marchent, le web est rempli d'erreurs sur ce sujet. | + | === Version Méthode 2 === |
+ | La version est définie dans ce fichier buildozer.spec: | ||
+ | < | ||
+ | # (str) Application versioning (method 1) | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # (str) Application versioning (method 2) | ||
+ | version = 1.2.0 | ||
+ | </ | ||
+ | |||
+ | ====Compilation==== | ||
+ | buildozer -v android debug | ||
+ | |||
+ | Le *.apk sera dans ./bin | ||
+ | |||
+ | =====openjdk 11 vs 8===== | ||
+ | ====L' | ||
+ | java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema | ||
+ | |||
+ | < | ||
+ | # Installing/ | ||
+ | # Run '/ | ||
+ | # Cwd / | ||
+ | Exception in thread " | ||
+ | at com.android.repository.api.SchemaModule$SchemaModuleVersion.< | ||
+ | at com.android.repository.api.SchemaModule.< | ||
+ | at com.android.sdklib.repository.AndroidSdkHandler.< | ||
+ | at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java: | ||
+ | at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java: | ||
+ | Caused by: java.lang.ClassNotFoundException: | ||
+ | at java.base/ | ||
+ | at java.base/ | ||
+ | at java.base/ | ||
+ | ... 5 more | ||
+ | # Command failed: / | ||
+ | </ | ||
- | **Nous utiliserons la version 8: facile !** | + | ====Issue 862==== |
+ | Aucunes des solutions proposées par **https:// | ||
- | sudo apt remove --purge openjdk-*-jdk | + | Les recherches avec ce message d' |
- | sudo apt install openjdk-11-jdk | + | |
- | Désinstallation | + | |
- | sudo apt install | + | |
- | Suppression des .buildozer du home et du dossier, recompil ... | + | |
+ | ====Nous utiliserons la version 8: facile !==== | ||
Installation de openjdk8: https:// | Installation de openjdk8: https:// | ||
wget -qO - https:// | wget -qO - https:// | ||
Ligne 74: | Ligne 183: | ||
Victoire ! Une application qui marche ! | Victoire ! Une application qui marche ! | ||
- | {{tag>kivy_2020 | + | La compilation est longue, quelques heures, quelques Go téléchargés. Une recompilation suite à une nouvelle version serait bien sûr rapide (10 secondes). |
+ | |||
+ | 13 Mo pour une application qui ne fait rien: **{{ media_09: | ||
+ | |||
+ | Lorsque la compilation fini sur une erreur, je fais table rase: suppression des .android, .buildozer du home et du dossier du projet. | ||
+ | |||
+ | ====Deboggage sur Android==== | ||
+ | * [[https:// | ||
+ | < | ||
+ | sudo apt-get install adb | ||
+ | adb root | ||
+ | adb shell | ||
+ | kminilte:/ | ||
+ | </ | ||
+ | |||
+ | {{tag> |
kivy_buildozer.1576753171.txt.gz · Dernière modification : 2019/12/19 10:59 de serge