Buildozer: manually include an external API

2019-09-11 05:25发布

问题:

I'd like to include an SDK library into the build that does not exist in PIP, or any public place on the Internet. I've read that this can be done manually. I put the SDK library in the root of my Kivy project. The development console finds this import just fine. The problem is with the deployment.

Looking at the buildozer.spec file I came across this:

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy

I have the SDK in a folder called sdk in the root of my project, hence I tried this:

requirements.source.sdk = sdk

It compiles without errors, but the application crashes when trying to import it.

How do I manually include an SDK library in to my APK?

回答1:

Well! you already figured out the answer that's put the SDK folder in your project folder.

I write this answer to help someone in future. :)

Whenever you deploy an application on your device, using logs is always easy and useful.

Even if you want to see the print statements in your application you would always find logs useful.

So, here's how you do it.

you need to use adb server.

  1. Connect your android with your laptop/pc.

  2. Got to developer options and turn on the stay awake and USB debugging options

  3. In your terminal type sudo adb-kill server then sudo adb-start server.
  4. Type adb devices(this should give list of devices connected)

List of devices attached

you_device_name device

  1. cd to your folder where you have made your build.
  2. Type buildozer android debug deploy run logcat > logcat.txt this saves the logs (for the entire process) in a file logcat.txt in the same folder. go through it and find your error.
  3. Keep your phone awake.(do not lock it).

Happy coding :)