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édenteProchaine révisionLes deux révisions suivantes | ||
kivy_comment_creer_une_application_android_en_python [2019/01/06 09:58] – serge | archives:kivy_comment_creer_une_application_android_en_python [2019/12/20 11:09] – [Des applications réussies jusqu'en avril 2018] 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 !** | ||
+ | </ | ||
+ | |||
+ | <WRAP center round box 60% centeralign> | ||
+ | **[[http:// | ||
+ | </ | ||
<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 45: | ||
* [[https:// | * [[https:// | ||
- | ====Cython==== | + | ====Quel Cython |
**[[https:// | **[[https:// | ||
* cython ou cython3 et quelle version ? | * cython ou cython3 et quelle version ? | ||
* buildozer avec pip ou pip3 et quelle version ? | * buildozer avec pip ou pip3 et quelle version ? | ||
- | * Android API ? SDK ? NDK ? | ||
- | =====Ressources===== | + | ====Quelle version de SDK, NDK et ANDROID API ?==== |
- | * [[https:// | + | |
- | * [[http:// | + | |
- | * [[https://kivy.org/docs/guide/ | + | |
- | ===== Kivy Virtual Machine (for Android/ | + | =====Hello World sur debian buster |
- | <WRAP center round tip 30%> | + | ====Installation des dépendances==== |
- | **La bonne solution en janvier 2019 !** | + | <code> |
- | </WRAP> | + | sudo apt-get install caja-open-terminal geany geany-plugins git gnome-system-tools locales |
- | * **[[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 | ||
+ | * buildozer 0.35 | ||
+ | * pygame-1.9.4 | ||
+ | ====Fichiers==== | ||
+ | <file python main.py> | ||
+ | #! / | ||
+ | # -*- coding: utf-8 -*- | ||
- | Je code sur ma cession hôte et je compile sur une session invitée: dossier projets partagé et bi-directif. | + | import kivy |
+ | kivy.require(' | ||
- | A priori, buildozer ne supporte pas les liens symboliques, | + | from kivy.app import App |
+ | from kivy.uix.label import Label | ||
- | ====Compilation==== | + | class MyApp(App): |
- | Ne pas télécharger de SDK et NDK, buildozer le fait. cela va créer un gros dossier .buildozer | + | def build(self): |
+ | return Label(text='Hello world' | ||
- | En janvier 2019: | + | if __name__ |
- | * ANDROIDAPI=19 | + | |
- | * ANDROIDSDK=/ | + | </file> |
- | * ANDROIDNDKVER=r9c | + | |
- | * SDK located at /home/kivy/.buildozer/ | + | |
- | * NDK located at /home/ | + | |
- | * NDK version is r9c | + | |
- | * API level set to 19 | + | |
- | # Search for Cython (cython) | + | <file python buildozer.spec> |
- | # -> found at /usr/local/ | + | [app] |
+ | title = My Application | ||
+ | package.name = myapp | ||
+ | package.domain = org.test | ||
+ | source.dir = . | ||
+ | build_dir = /build/myapp | ||
+ | source.include_exts = py, | ||
+ | version = 3.00 | ||
+ | requirements = python3, | ||
+ | orientation = portrait | ||
+ | fullscreen = 0 | ||
+ | android.arch = armeabi-v7a | ||
- | Writing | + | android.api = 24 |
+ | android.sdk = 20 | ||
+ | android.ndk = 14b | ||
+ | android.ndk_path = /media/sf_data/src_android/android-ndk-r14b | ||
+ | android.sdk_path = /media/sf_data/src_android/android-sdk-20 | ||
+ | [buildozer] | ||
+ | log_level = 2 | ||
+ | warn_on_root = 1 | ||
+ | </ | ||
- | ===== Kivy Virtual Machine (for Android/ | + | =====Hello World sur Xubuntu 18.04 |
+ | ** Problème: ce n'est pas python3.7 !!!** | ||
+ | ====Installation de buildozer à partir de la branche master sur github==== | ||
+ | sudo pip3 install https:// | ||
+ | installe buildozer 0.38 dev0 | ||
- | ===== Python-for-Android : sans intérêt !===== | + | sudo pip3 install git+https:// |
- | * **[[https:// | + | Successfully installed Kivy-1.11.0.dev0 |
- | 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' | ||
- | ====Sur Github dans le projet Kivy==== | ||
- | 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. | ||
- | Les fonctionnalités incluent: | + | ===== Kivy Virtual Machine (for Android/ |
- | * Prise en charge de la construction avec Python 2 et Python 3. | + | * Voir ** [[https:// |
- | | + | |
- | | + | |
- | * Cibles d'architecture multiples, pour les APK optimisés sur n'importe quel appareil. | + | |
- | Pour la documentation et le support, voir: | + | ===== Des applications réussies jusqu' |
- | * Site Web: http://python-for-android.readthedocs.io | + | * **[[https://wiki.labomedia.org/ |
- | * Liste de diffusion: https://groups.google.com/forum/#!forum/kivy-users ou https://groups.google.com/forum/#!forum/python-android. | + | * **[[:taposc|Kivy: |
+ | * **[[https://github.com/sergeLabo/wikikircandroid2|]]** | ||
+ | * **[[https:// | ||
+ | * **[[https://github.com/sergeLabo/TCPclient|Un client TCP simple pour test]]** | ||
+ | * **[[https:// | ||
+ | * **[[https:// | ||
+ | * **[[https:// | ||
- | En 2015, ces outils ont été réécrits pour fournir une nouvelle interface, plus facile à utiliser et à étendre. | + | {{tag>archive |
- | + | ||
- | ===== Des jeux qui marchent ===== | + | |
- | * **[[https:// | + | |
- | * | + | |
- | {{tag>kivy sb}} | + |
archives/kivy_comment_creer_une_application_android_en_python.txt · Dernière modification : 2020/04/03 17:59 de serge