Hello Kivy/Buildozer Community,
I've been trying to compile a simple Kivy application for Android using Buildozer, and I'm encountering a very persistent and perplexing issue where Buildozer consistently reports 'Unknown command/target clean' or 'Unknown command/target android', despite extensive troubleshooting. buildozer init works, which is the most confusing part.
I've followed numerous guides, including the official documentation, and have gone through a comprehensive debugging process. I'm hoping someone here might have encountered a similar deep-seated problem or can offer new insights.
My System Specifications:Operating System: Windows 11 Pro (latest updates installed)
Processor (CPU): Intel Core i7 (13th Generation)
RAM: 32 GB
Free Disk Space (C: drive): 1 TB
The core issue is that when I run buildozer android debug -v or buildozer clean, Buildozer returns: # Check configuration tokens Unknown command/target clean (or android)
However, when I run buildozer init, it correctly states: ERROR: You already have a buildozer.spec file. This indicates that buildozer itself is found, and its init command module is loaded, but others are not.
Troubleshooting Steps Attempted (Chronological Order):I've tried both native Windows installation and WSL, with multiple cleanups and reinstallations.
A. Initial Attempts (Windows Native Environment):Python Version: Started with Python 3.9. Installed Python 3.9.2, ensuring it was added to PATH and was the primary Python (where python confirmed Python39 path, python --version showed 3.9.2).
Project Location: Moved the AppPallina project to C:\AppPallina to avoid potential permission issues on other drives.
Virtual Environments: Created and activated multiple clean virtual environments (e.g., venv_kivy_39).
Dependency Installation: Installed Kivy (pip install "kivy[full]"), Cython, python-for-android, and Buildozer (pip install buildozer) within these virtual environments. Initial attempts often showed Defaulting to user installation because normal site-packages is not writeable warnings, which were later resolved.
Buildozer.spec: Ensured buildozer.spec was correctly configured with requirements = python3,kivy and appropriate android.api/minapi levels.
Error Persistence: Despite resolving installation warnings, the Unknown command/target android (and clean) error persisted consistently.
Manual Buildozer Installation: Attempted to install Buildozer manually by cloning its Git repository (git clone https://github.com/kivy/buildozer.git) and installing in editable mode (pip install -e .). This also resulted in the same Unknown command/target errors.
Internal File Check: Manually checked the C:\AppPallina\buildozer\buildozer directory. Found __main__.py and targets directory, but the commands directory was explicitly missing. Attempts to download it manually failed (404 error, indicating a refactoring of the Buildozer repository).
Given the persistent issues on native Windows, we shifted to WSL as the recommended environment.
WSL Installation: Executed wsl --install in an elevated PowerShell.
Initial Problem: Ubuntu did not launch automatically after installation.
Troubleshooting:
Manually tried launching "Ubuntu" from Start Menu (no response).
Verified "Sottosistema Windows per Linux" and "Piattaforma macchina virtuale" were enabled in "Attiva o disattiva funzionalità di Windows" (initially "Piattaforma macchina virtuale" was not visible).
Used dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart in PowerShell (Admin) to force-enable it.
Ensured virtualization was enabled in BIOS/UEFI.
Checked wsl --status (showed WSL 2, WSL1 non è supportato).
Used wsl --list --verbose (initially showed no distributions).
Used wsl --unregister Ubuntu and wsl --install -d Ubuntu to perform a clean reinstall of Ubuntu.
Success: Ubuntu eventually installed and launched, allowing user creation.
Ubuntu System Setup (within WSL Terminal):
Updated system packages: sudo apt update and sudo apt upgrade -y.
Encountered TypeError: 'tuple' object is not callable during apt update (known Ubuntu 24.04 bug, ignored as non-critical for core functionality).
Encountered Errors were encountered while processing: python3-pip and E: Sub-process /usr/bin/dpkg returned an error code (1) during apt upgrade.
Resolution: Used sudo dpkg --configure -a followed by sudo apt update --fix-missing and sudo apt upgrade -y. This successfully resolved the python3-pip and dpkg errors, bringing the Ubuntu system to a fully updated and clean state.
Kivy/Buildozer Installation in WSL (on Windows-mounted drive):
Navigated to the Windows project folder: cd /mnt/c/AppPallina.
Created a virtual environment (python3 -m venv venv_kivy_wsl_final).
Persistent Error: Error: Command '['/mnt/c/AppPallina/venv_kivy_wsl_final/bin/python3', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1. This error prevented the virtual environment from being created correctly. This indicated a fundamental problem with venv/ensurepip when interacting with the Windows filesystem via WSL.
Kivy/Buildozer Installation in WSL (on Linux Native Home Directory):
Copied the project to the Linux home directory: cp -r /mnt/c/AppPallina/* ~/AppPallina_WSL/.
Navigated to ~/AppPallina_WSL.
Created a new virtual environment: python3 -m venv venv_kivy_wsl_home_final.
Crucial Success: This time, the python3 -m venv command SUCCEEDED without the ensurepip error! The virtual environment was created correctly.
Activated the virtual environment: source venv_kivy_wsl_home_final/bin/activate (successful).
Installed Buildozer dependencies: pip install --upgrade pip setuptools wheel, pip install "kivy[full]", pip install Cython, pip install python-for-android, pip install buildozer.
Encountered Cython (cython) not found, please install it. (Resolved by pip install Cython).
Encountered FileNotFoundError: [Errno 2] No such file or directory: 'unzip' (Resolved by sudo apt install -y unzip).
Encountered sdkmanager path "..." does not exist, sdkmanager is not installed after SDK/NDK download. This is where the last attempt failed.
Current State:
After resolving unzip and Cython, the buildozer android debug -v command proceeds further, downloading SDK and NDK.
However, when I try to run buildozer clean or buildozer android debug -v again after the sdkmanager error, it reverts to the original Unknown command/target clean (or android) error.
buildozer init works reliably, indicating the buildozer executable and its init command module are found and loaded.
Other commands (clean, android) consistently report Unknown command/target, even after a successful init.
The commands directory is no longer present in the Buildozer Git repository structure (version 1.5.0), suggesting a refactoring, but the internal loading mechanism seems to fail on my system.
The ensurepip error when creating virtual environments on Windows-mounted drives in WSL was resolved by moving the project to the Linux home directory, suggesting a filesystem interaction issue.
All system-level dependencies (git, javac, keytool, unzip, Cython) and Python/pip installations in WSL are verified as correct and up-to-date.
It feels like Buildozer is losing its ability to discover or load its internal command definitions after the initial init or during the more complex android debug process.
Any insights or suggestions would be greatly appreciated. Thank you for your time and help!
Use github method always to convert kivy to apk. Otherwise there are so many problems in other method.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/kivy-users/1ade7883-2992-466b-ba05-c419d64023d2n%40googlegroups.com.