Ceci est une ancienne révision du document !
As I promised in part 37, we will take the transposer app that we created, and create an APK to install it on your android device.
Before we get started, let’s make sure we have everything ready. First thing we need is the two files we created last time in a folder that you can easily access. Let’s call it “transposer”. Create it in your home directory. Next, copy the two files (transpose.kv and transpose.py) into that folder. Now rename transpose.py to main.py. This part is important.
Next, we need to reference the kivy packaging instructions in a web browser. The link is http://kivy.org/docs/guide/packaging-android.html. We will be using this for the next steps, but not exactly as the Kivy people intended. You should have the android SDK from our earlier lesson. Ideally, you will go through and get all the software that is listed there, but for our purposes, you can just follow along here. You will need to download the python-for-android software. Open a terminal window and type the following…
git clone git:github.com/kivy/python-for-android This will download and set up the software that we need to continue. Now, in a terminal window, change your directory to the python-for-android/dist/default folder. Now you will find a file called build.py. This is what will do all the work for us. Now comes the magic. The build.py program will take various command-line arguments and create the APK for you. Shown above is the syntax for build.py taken directly from the Kivy documentation. For our use, we will use the following command (the “\” is a line continuation character): ./build.py –dir ~/transposer –package org.RainyDay.transposer \ –name “RainyDay Transposer” –version 1.0.0 debug Let’s look at the pieces of the command… ./build.py - this is the application –dir ~/transposer - this is the directory where our application code lives. –package org.RainyDay.transposer - This is the name of the package –name “RainyDay Transposer” - this is the name of the application that will show up in the apps drawer. –version 1.0.0 - the version of our application debug - this is the level of release (debug or release) Once you execute this, assuming that everything worked as expected, you should have a number of files in the /bin folder. The one you are looking for is titled “RainyDayTransposer-1.0.0-debug.apk”. You can copy this to your android device using your favorite file manager app, and install it just like any other application from the various app stores. That’s all I have time for this month.