archives:kivy_comment_creer_une_application_android_en_python
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_comment_creer_une_application_android_en_python [2019/01/06 10:34] – [Compilation] serge | archives:kivy_comment_creer_une_application_android_en_python [2020/04/03 17:59] (Version actuelle) – serge | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ======Kivy Comment créer une application android en python====== | + | ======Archives : Kivy Comment créer une application android en python====== |
+ | |||
+ | <WRAP center round alert 60%> | ||
+ | **Cette page est obsolète, elle est en archives !** | ||
+ | |||
+ | Voir **[[:: | ||
+ | </ | ||
<WRAP center round box 60% centeralign> | <WRAP center round box 60% centeralign> | ||
**{{tagpage> | **{{tagpage> | ||
</ | </ | ||
- | =====Les problèmes avec buildozer===== | + | <WRAP center round important 60% centeralign> |
- | ====Qu'en disent les internets ?==== | + | **Buildozer compile le Python 3 par défaut !**\\ |
+ | **Mais je n'ai pas réussi à obtenir un *.apk** | ||
+ | Et ça ne marche pas non plus en python 2 ! | ||
+ | </ | ||
+ | |||
+ | <WRAP center round info 60% centeralign> | ||
+ | Testé en janvier 2019 sur:\\ | ||
+ | **Debian Buster alpha 4**\\ | ||
+ | et sur \\ | ||
+ | **Xubuntu 18.04 dans VirtualBox** | ||
+ | </ | ||
+ | |||
+ | =====Buildozer et python 3===== | ||
+ | **[[https:// | ||
+ | |||
+ | Buildozer est un des projets de kivy. **Quand ça marche**, c'est super pratique. Cela permet de créer une application Andoid à partir de script python utilisant **[[https:// | ||
+ | |||
+ | Last but not least, un tas de package python ne sont pas supportés. | ||
+ | |||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | |||
+ | =====Les problèmes avec buildozer | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
Ligne 13: | Ligne 43: | ||
* [[https:// | * [[https:// | ||
- | ====Cython==== | + | ====Quel Cython |
**[[https:// | **[[https:// | ||
Ligne 19: | Ligne 49: | ||
* buildozer avec pip ou pip3 et quelle version ? | * buildozer avec pip ou pip3 et quelle version ? | ||
- | ====Version | + | ====Quelle version |
- | Dans le wiki Kivy, pages non indexées par les moteurs de recherches | + | * **[[https:// |
- | * **https:// | + | =====Hello World sur debian buster avec python 3.7 dans une VirtualBox===== |
- | + | ====Installation des dépendances==== | |
- | =====Ressources===== | + | <code> |
- | * [[https:// | + | sudo apt-get install caja-open-terminal geany geany-plugins git gnome-system-tools locales |
- | * [[http:// | + | |
- | * [[https:// | + | |
- | + | ||
- | ===== Kivy Virtual Machine (for Android/ | + | |
- | <WRAP center round tip 30%> | + | |
- | **La bonne solution en janvier 2019 !** | + | |
- | </ | + | |
- | * **[[https:// | + | sudo dpkg --add-architecture i386 |
+ | sudo apt-get update | ||
- | wget -c kivy-buildozer-vm-2.0.zip | + | sudo apt-get install libsdl2-dev zlib1g-dev pkg-config autoconf automake cmake dkms libtool libsdl2-2.0-0 ccache openjdk-11-jdk unzip ffmpeg libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libgstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good libncurses5: |
- | ====Installation==== | + | sudo pip3 install jinja2 appdirs sh colorama setuptools cython |
- | Il faut apprendre VirtualBox, c'est particulier mais pas compliqué, ce n'est pas [[https:// | + | sudo pip3 install pygame kivy buildozer pyjnius |
+ | </code> | ||
- | ====VirtualBox==== | + | ====Version==== |
- | | + | |
- | + | * kivy 1.10.1 | |
- | Je code sur ma cession hôte et je compile sur une session invitée: dossier projets partagé et bi-directif. | + | |
- | + | * pygame-1.9.4 | |
- | A priori, | + | ====Fichiers==== |
- | + | ||
- | ====Compilation==== | + | |
- | ===Un hello world=== | + | |
<file python main.py> | <file python main.py> | ||
- | #! / | + | #! / |
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||
import kivy | import kivy | ||
- | print(kivy.__version__) | ||
kivy.require(' | kivy.require(' | ||
Ligne 67: | Ligne 88: | ||
if __name__ == ' | if __name__ == ' | ||
MyApp().run() | MyApp().run() | ||
- | <code> | + | </file> |
- | <code python | + | <file python |
[app] | [app] | ||
title = My Application | title = My Application | ||
Ligne 77: | Ligne 98: | ||
build_dir = / | build_dir = / | ||
source.include_exts = py, | source.include_exts = py, | ||
- | version = 0.02 | + | version = 3.00 |
- | requirements = python2,kivy | + | requirements = python3,kivy |
orientation = portrait | orientation = portrait | ||
fullscreen = 0 | fullscreen = 0 | ||
- | # (str) The Android arch to build for, choices: armeabi-v7a, | ||
android.arch = armeabi-v7a | android.arch = armeabi-v7a | ||
+ | |||
+ | android.api = 24 | ||
+ | android.sdk = 20 | ||
+ | android.ndk = 14b | ||
+ | android.ndk_path = / | ||
+ | android.sdk_path = / | ||
+ | |||
[buildozer] | [buildozer] | ||
- | # (int) Log level (0 = error only, 1 = info, 2 = debug (with command output)) | ||
log_level = 2 | log_level = 2 | ||
- | # (int) Display warning if buildozer is run as root (0 = False, 1 = True) | ||
warn_on_root = 1 | warn_on_root = 1 | ||
- | <code> | + | </file> |
- | + | ||
- | Ne pas télécharger de SDK et NDK, buildozer le fait. cela va créer un gros dossier .buildozer (1 Go) dans chacun de vos projets mais au moins ça marche et c'est vraiment du boulot parfait pour un fainéant: c'est ordi qui bosse pas vous ! | + | |
- | + | ||
- | En janvier 2019: | + | |
- | * ANDROIDAPI=19 | + | |
- | * ANDROIDSDK=/home/ | + | |
- | * ANDROIDNDKVER=r9c | + | |
- | * SDK located at / | + | |
- | * NDK located at / | + | |
- | * NDK version is r9c | + | |
- | * API level set to 19 | + | |
- | + | ||
- | # Search for Cython (cython) | + | |
- | # -> found at / | + | |
- | + | ||
- | Writing / | + | |
- | + | ||
- | + | ||
- | ===== Kivy Virtual Machine (for Android/ | + | |
- | ===== Python-for-Android : sans intérêt !===== | + | =====Hello World sur Xubuntu 18.04 avec python 3.6.7 dans une VirtualBox===== |
- | * **[[https://github.com/ | + | ** Problème: ce n'est pas python3.7 !!!** |
- | Cela fait partie du projet Kivy, la doc sur les SDK et NDK est nulle à souhait, et il y a autant de problèmes qu' | + | ====Installation de buildozer à partir de la branche master sur github==== |
- | ====Sur Github dans le projet Kivy==== | + | sudo pip3 install https:// |
- | Python-for-Android est un emballeur pour les applications Python sur Android. Vous pouvez créer votre propre distribution Python, y compris les modules et dépendances de votre choix, et la regrouper dans un APK avec votre propre code. | + | installe buildozer 0.38 dev0 |
- | Les fonctionnalités incluent: | + | sudo pip3 install git+https://github.com/ |
- | * Prise en charge de la construction avec Python 2 et Python 3. | + | Successfully installed |
- | * Différents moteurs d' | + | |
- | * Prise en charge automatique de la plupart des modules Python purs et prise en charge intégrée de nombreux autres, notamment les dépendances courantes telles que numpy et sqlalchemy. | + | |
- | * Cibles d' | + | |
- | Pour la documentation et le support, voir: | ||
- | * Site Web: http:// | ||
- | * Liste de diffusion: https:// | ||
- | En 2015, ces outils ont été réécrits | + | ===== Kivy Virtual Machine (for Android/ |
+ | * Voir ** [[https:// | ||
- | ===== Des jeux qui marchent | + | ===== Des applications réussies jusqu' |
* **[[https:// | * **[[https:// | ||
- | * **[[taposc|Kivy: | + | * **[[:taposc|Kivy: |
* **[[https:// | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
Ligne 137: | Ligne 137: | ||
* **[[https:// | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
- | * **[[https:// | + | * **[[https:// |
- | {{tag>kivy sb}} | + | {{tag>archive |
archives/kivy_comment_creer_une_application_android_en_python.1546770857.txt.gz · Dernière modification : 2019/01/06 10:34 de serge