Kivy is an open source Python framework used to quickly develop applications and implement various currently popular user interfaces, such as multi-touch and so on. And Kivy can run on most current mainstream desktop/mobile operating systems such as Windows, Linux, MacOS, Android, and iOS.
First you need to install the virtual machine VirtualBox. This is no problem. It was installed quickly. Then Kivy officially produced the image of the virtual machine (very considerate) , you can run it directly after downloading, saving you a lot of trouble.
After downloading and decompressing, open VB and load the virtual machine file in the folder, and then run (login password kivy):
Enter /home/kivydev//test is the test directory. py2apk in this directory is packaged with py27, and py3apk is packaged with py35. The only difference between these two versions is the different versions of py configuration files. The py files in this directory must be used Main.py can only be packaged after naming it. First compile main.py in this directory to see if it can be successfully executed: python3 After main.py can be successfully compiled, execute the packaging command in the directory of py2apk or py3apk:
p4a apk
The apk file can be generated in this directory;
This is only for testing, use the apk generated by main.py, The running effect on the mobile phone is as follows:
Afterword
At this point, the simple py file can be completed Encapsulated. As for how to write the py file to be suitable for the Android version, how to change the icon, and how to set the content inside, it is recommended to read the official document to learn,
The above is the detailed content of How to package apk in python. For more information, please follow other related articles on the PHP Chinese website!