1

I created a simple app in python3 using Kivy for the UI and bluepy to access some Bluetooth BLE devices. Now I like to port the app to my Android phone. I saw there is somehow a port in Kivy to Android (https://github.com/kivy/python-for-android). But I am not sure if I can port my app with the bluepy dependency.

So it comes down to the questions:

1st) is it possible to port a kivy and bluepy app to Android?

2nd) is there a tutorial showing how to do that?

Stefan Jaritz
  • 1,999
  • 7
  • 36
  • 60
  • 2
    I didn't use bluepy but I compiled apks with stand-alone libs. You just write in buildozer file ('required' field in the spec file) which libraries it should download before compiling so it will add it to apk. And of course you should add permission requests to use Bluetooth in your app etc. – Lothric Feb 20 '20 at 18:59

1 Answers1

0

You can package an Android app using Buildozer. You can do it using this guide on the Kivy website. If you are using Windows you can use the WSL (Windows Subsystem for Linux). Here is a guide. I have used it to package my Android app. (By the way I installed Ubuntu from the Windows Store.) Keep in mind that this is a command-line, not a GUI (Graphical User Interface). Hope my answer works for you! (If you get any errors, make sure to comment.)

EDIT: You need to include "bluepy" in the requirements variable in the buildozer.spec file.

  • it's only half way. I am missing a comment how buildozer deals with non std. python libs like bluepy – Stefan Jaritz Feb 20 '20 at 16:57
  • the buildozer crashes if you have 2 java jdks installed(for me I had 14 and 8). How can I set the java version buildozer should use? – Stefan Jaritz Feb 23 '20 at 15:56
  • so before building you need to make sure that java 8 jdk is activated. I can build my project now and execute it on my phone. But the BLE stuff doesn't work. Any ideas? – Stefan Jaritz Feb 23 '20 at 16:37
  • Add BLUETOOTH to the variable android.permissions in the buildozer.spec file. – PythonPython Feb 23 '20 at 19:08
  • I still getting a "Error 13 Permission denied: ...site-packages/bluepy/bluepy-helper" think this refers to https://stackoverflow.com/questions/59786226/how-to-setup-the-enviroment-that-bluepy-can-scan-without-sudo/59798285#59798285 – Stefan Jaritz Feb 24 '20 at 16:09