简体   繁体   English

如何开始打包我的Android应用程序? [KIVY]

[英]How do I start packaging my app for android? [KIVY]

How should I go about making my kivy application work on a Samsung Galaxy S7? 我应该如何使我的kivy应用程序在Samsung Galaxy S7上运行? How much of the code do I have to change to make it work? 我必须更改多少代码才能使其正常工作? Do I get features of the phone like handling "back" or vibration? 我是否可以获得手机的功能,例如“后退”或震动? Currently my code has two files, a calc.py file which handles all the back-end calculations that are given from main.py which is a KivyApp class which returns my main class. 目前,我的代码有两个文件,一个calc.py文件,该文件处理从main.py给出的所有后端计算,这是一个返回我的主类的KivyApp类。

There are also images that are used in the same folder from main.py main.py同一文件夹中使用了main.py

If there is a better place to post this please tell me 如果有更好的发布位置,请告诉我

Thank you! 谢谢!

You are on the right place to ask this. 您来对地方了。

First you have to convert your app in a apk using python-for-android, the easiest way is to use buildozer . 首先,您必须使用python-for-android将您的应用转换为apk,最简单的方法是使用buildozer
You'll probably need to make your code compatible with python2, apparently there is a new buildozer that allow pure python3, but the classic one work on python2. 您可能需要使您的代码与python2兼容,显然有一个新的buildozer可以使用纯python3,但是经典的版本可以在python2上运行。

For the images, if you want to keep them here, it will work, but I recommend that you put them on a "img" repo. 对于图像,如果要将它们保留在此处,则可以使用,但是我建议您将它们放在“ img”存储库中。

For the vibrations, and other android behaviors, there are 3 way to do this: 对于振动和其他Android行为,有3种方法可以做到这一点:
pyjnius that let you use every component you want by creating a binding to the android class. pyjnius ,让您可以通过创建与android类的绑定来使用所需的每个组件。
plyer that have already create you a easy binding but don't have all the fonctionnalities. 折叠器已经为您创建了轻松的绑定,但没有所有的功能。
python-for-android api , that is also really easy. python-for-android api ,这也非常容易。

I recommand you check if you can do what want first with python-for-android or plyer, and if you can't, give a try to pyjnius. 我建议您检查是否可以先使用python-for-android或plyer做想要做的事情,如果不能做,请尝试pyjnius。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM