Good day. I wrote a simple script in the Qpython3 application, which says that the charging is connected and that the battery is charged. Qpython uses the sl4a module ie:

import sl4a droid = sl4a.Android() 

and further code ..

This all works great on the phone (Nexus5). I decided to make an application of this script independent of Qpython, etc.

Since there is a little experience building an application written in python and kivy is used as a kivy , then the gui did, and inside the start button. I built the application using buildozer , after installing python-android . If you install this package on python 2.7.10 , then enter:

 import android dir(android) 

no Android class

If to install on python 3.4.3 , then at import the error generally falls out.

If you do the same in Qpython, you can see that the Android class is present.

I found sl4a.py on my phone and threw a folder on my computer in the same folder, I imported it, but when debugging you can see that there are some errors about socket (described in the Android class in the init section):

 def __init__(self, addr=None): if addr is None: addr = HOST, PORT self.conn = socket.create_connection(addr) self.client = self.conn.makefile("rw") self.id = 0 if HANDSHAKE is not None: self._authenticate(HANDSHAKE) 

In general, the question is: is it possible to somehow use this module to build your application ( apk ) or can sl4a be used only with Qpython?

I also tried to build the application as described here: https://github.com/kivy/python-for-android in this case, the installed application instead of 30 meters (when building buildozer) takes 100 meters! But also does not work.

how vidyushka collected

  • try to build an empty project and fix it - look at what mistakes are poised, maybe not in the classroom case - titov_andrei

1 answer 1

Here are links to the original sites:

https://kivy.org/docs/guide/packaging-android.html

http://buildozer.readthedocs.org/en/latest/installation.html

It describes the instructions in several lines.

While he himself did on various articles and lessons - there were lining. Made according to the instructions of the developers and everything began to gather and deploy.