Python/Kivy app to apk on windows - what to do aft

2020-02-01 06:41发布

问题:

I understand that currently there is no way to package a kivy app for android using windows, so I have downloaded a Linux virtual machine. But then what? I haven't found a good step-by-step tutorial for beginners explaining the whole process.

Am I supposed to download Python, PyCharm, Kivy, etc. into the virtual machine, and also copy the all the app files into it? And if so, what's the next step after that? Sorry to be so clueless, but I'm new to coding and app development, and learning mostly from online tutorials. Any advice is greatly appreciated!

回答1:

You can package Kivy Apps for Android on Windows by doing the following:

Kivy Buildozer Virtual Machine Setup

  1. Download Kivy Buildozer VM and unzip the file.
  2. Download the version of VirtualBox for your machine from Oracle VirtualBox download area and install it.
  3. Download Oracle VM VirtualBox Extension Pack for all platforms and install it.
  4. Start VirtualBox, click on File » Import Appliance...
  5. Select the extracted directory, file named, Buildozer VM.ovf
  6. Click on Settings » General » Advanced and select Bidirectional in the drop-down list for Shared Clipboard:, and Drag'n'Drop:
  7. Click on Settings » Shared Folders and click Adds new shared folder. e.g. Kivy Apps folder.
  8. Click on Settings » USB, check Enable USB Controller, checkbox USB 2.0 (EHCI) Controller, and click Adds new USB filters e.g. Acer tablet.

PyCharm IDE Setup

  1. Download PyCharm Community and install it.
  2. Install KV Lang Auto-completion and Highlighting
  3. Please refer to PyCharm Project Interpreter Setup

Create a Package for Android

  1. Start VirtualBox, select Kivy/Buildozer VM and click Start
  2. Password is kivy
  3. Copy your Kivy App from local machine to a folder in Home folder.
  4. Double click Home folder
  5. Double click Kivy App folder
  6. Right mouse click and select Open Terminal Here
  7. At Terminal command prompt, type buildozer init to create buildozer.spec file.
  8. Double click buildozer.spec file to make changes (e.g. title, package.name, log_level = 2) and save changes.
  9. At Terminal command prompt, type buildozer android debug deploy run
  10. Enjoy!