Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling Kivy project and run it with Android emulator

I am thinking of writing a simple app with Python+Kivy, mostly for my own use - nothing fancy. For development, I would like to be able to

  • Compile the app into a package
  • Run it on an Android emulator

Sadly, at the moment I cannot quite close the loop - and googling didn't help.

I believe I downloaded all the relevant tools: Kivy, buildozer, Android SDK. I typed in the Kivy 'hello world' app, and it runs fine without Android emulation - unfortunately, when running it under the emulator (with suggested architecture x86), I get an error INSTALL_FAILED_NO_MATCHING_ABIS. If I make an emulator device with an ARM architecture (which is pretty slow to run), I can at least install the app on the emulated device - but it crashes once loaded. Error message is not informative.

I am guessing somehow I need to build the package for the native x86 architecture (?) which is the recommended default emulator in the Android emulator wizard - is that right? If so, how do I do it with buildozer tool? Or maybe I can run it on the ARM architecture, without it crashing?

Some finer detail:

  • I am running on OSX
  • I am building the package with the suggested command buildozer -v android debug
  • To install the app, I drag it onto the emulator window (there probably is a better way..?)
  • The emulator is the one coming with Android SDK, I'm emulating the default 'Nexus 5X' phone
  • Android SDK version is 23
like image 452
magiiique Avatar asked Dec 06 '25 21:12

magiiique


2 Answers

I suggest trying to install the app on a real device and connecting the device to your pc in debug mode and use adb logcat to get the log of the device to know what is causing the error. This way you can make sure if the problem rises from your code or your emulator environment.

like image 99
Juggernaut Avatar answered Dec 08 '25 10:12

Juggernaut


Your setup sounds fine, the immediate problem is entirely the architecture (although the crash on your ARM emulator suggests that your app has a bug, which you can debug by checking out the logcat log).

python-for-android supports x86 and will work on the emulator this way. You can use this with --arch=x86. However, buildozer does not currently expose this option (it hardcodes armeabi-v7a). This wouldn't be difficult to fix, feel free to open an issue in the buildozer github repository about it.

I'll note that if you have a device available, debugging using that isn't really any different (or slower/faster) than using the emulator. Buildozer/python-for-android can push the apk and run it automatically, and viewing the logcat output works the same in both cases.

like image 44
inclement Avatar answered Dec 08 '25 10:12

inclement



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!