How to include a .aar file in a Kivy/Buildozer Android project
11:15 13 Oct 2025

I would like to add a .aar file (onnxruntime.aar) to my Kivy project. My project structure is:

├── buildozer.spec
├── dress.jpg
├── libs
│   └── onnxruntime.aar
├── log.txt
├── main.py
├── __pycache__
│   ├── temp3.cpython-310.pyc
│   ├── temp3.cpython-39.pyc
│   ├── tflite_models2.cpython-310.pyc
│   ├── tflite_models2.cpython-39.pyc
│   └── tflite_models.cpython-39.pyc
├── temp3.py
└── tflite_models2.py

In my buildozer.spec, I have:

[app]

# (str) Title of your application
title = Test_onnx_image

# (str) Package name
package.name = test_onnx

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,aar

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy==2.3.1,numpy,filetype,plyer,pillow,pyjnius
android.requirements.source.pyjnius = https://github.com/kivy/pyjnius/archive/refs/heads/master.zip

# (list) Android AAR archives to add (currently works only with sdl2_gradle
# bootstrap)
android.add_aars = android.add_aars = libs/onnxruntime.aar

But When I try to build the .APK:

buildozer -v android debug

i get the following error:

[INFO]: Detected highest available build tools version to be 36.1.0
[DEBUG]: -> running gradlew clean assembleDebug 
[DEBUG]: > Task :checkDebugAarMetadata FAILED 
[DEBUG]: 
[DEBUG]: FAILURE: Build failed with an exception. 
[DEBUG]: 
[DEBUG]: * What went wrong: 
[DEBUG]: Execution failed for task ':checkDebugAarMetadata'. 
[DEBUG]: > Could not resolve all files for configuration':debugRuntimeClasspath'.
[DEBUG]: > Could not find :onnxruntime:. 
[DEBUG]: Required by:
[DEBUG]: project : 
[DEBUG]: 
[DEBUG]: * Try: 
[DEBUG]: > Run with --stacktrace option to get the stack trace.  
[DEBUG]: > Run with --info or --debug option to get more log output.  
[DEBUG]: > Run with --scan to get full insights. 
[DEBUG]: 
[DEBUG]: * Get more help at https://help.gradle.org/ 
[DEBUG]: 
[DEBUG]: Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
[DEBUG]: 
[DEBUG]: You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. 
[DEBUG]: 
[DEBUG]: See https://docs.gradle.org/8.0.2/userguide/command_line_interface.html#sec:command_line_warnings

what am i doing wrong?

python kivy buildozer aar onnx