You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Buildozer构建Kivy安卓应用时出现输出错误

Troubleshooting Buildozer Android Build Failures on Linux Mint 19 (Python 3 + Kivy)

Hey there! Let’s work through this frustrating build issue you’re hitting. Reinstalling Buildozer and Kivy is a good first step, but these types of errors often stem from missing system dependencies, misconfigured Buildozer settings, or version mismatches in the Android SDK/NDK. Here’s a step-by-step breakdown of fixes to try:

1. Fix Buildozer Configuration (buildozer.spec)

Your buildozer.spec file is likely missing or using incompatible settings. Update these key sections:

  • Set a compatible Python version (Linux Mint 19’s default Python 3.6 works well with Buildozer):
    python.version = 3.6
    
  • Specify a stable Kivy version to avoid compatibility gaps:
    requirements = kivy==2.1.0
    
  • Force a compatible Android NDK/SDK version (older versions often resolve build conflicts):
    android.ndk = 25b
    android.sdk = 33
    

2. Install Critical System Dependencies

Linux Mint 19 (based on Ubuntu 18.04) requires several system packages that Buildozer relies on. Run this command to install them:

sudo apt-get update && sudo apt-get install -y git zip unzip openjdk-8-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5 cmake libffi-dev libssl-dev

Important: Ensure you’re using OpenJDK 8—newer Java versions are not fully compatible with the Android build tools used by Buildozer.

3. Clear Buildozer Cache & Old Build Files

Stale cache or corrupted build artifacts often cause repeat failures. Clean everything up with these steps:

  • Run the official clean command:
    buildozer android clean
    
  • Delete the hidden .buildozer directory (this stores SDK/NDK and build intermediates):
    rm -rf .buildozer
    
  • Remove old APK files from the bin directory if they exist:
    rm -rf bin/
    

4. Use a Virtual Environment for Isolation

System-wide Python package conflicts can break builds. Create a fresh virtual environment to isolate your Kivy/Buildozer setup:

  1. Create and activate the environment:
    python3 -m venv kivy_build_env
    source kivy_build_env/bin/activate
    
  2. Install stable versions of Buildozer and Kivy:
    pip install buildozer==1.4.0 kivy==2.1.0
    

5. Set Correct Environment Variables

Ensure Buildozer can find Java and other tools by setting these variables:

  • Export JAVA_HOME temporarily:
    export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
    
  • Make this permanent by adding it to your ~/.bashrc:
    echo "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> ~/.bashrc
    source ~/.bashrc
    

6. Get Verbose Logs for Further Debugging

If the issue persists, run the build with verbose logging to pinpoint the exact failure point:

buildozer android debug -v

Look for error messages related to missing libraries, failed downloads, or version mismatches—these will give you more specific clues to resolve the problem.


内容的提问来源于stack exchange,提问作者Alberto

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 16:53:03