Briefcase P4A Backend
Python-for-Android (P4A) backend for Briefcase - Build Android APKs using python-for-android directly within Briefcase's build pipeline.
Features
- Direct P4A Integration: Uses python-for-android without Gradle or Buildozer
- Briefcase SDK Integration: Uses Briefcase's Android SDK management system
- Python 3.13 Compatibility: Automatically patches pyjnius 1.6.1 for Python 3.13+ compatibility
- Framework Agnostic: Works with Kivy, console apps, and other Python frameworks
Installation
pip install briefcase-p4a-backend
Usage
- Create a new Briefcase project:
briefcase new -t https://github.com/pyCino/briefcase-p4a-template.git --template-branch main
# Choose any GUI framework when prompted
- Configure for P4A backend in
pyproject.toml:
[tool.briefcase.app.yourapp.android]
build_backend = "briefcase_p4a_backend"
- Build your Android APK:
briefcase create android p4a
briefcase build android p4a
How It Works
The P4A backend integrates with Briefcase's existing Android toolchain:
- Briefcase Integration: Registers as
android.p4aformat in Briefcase - Template System: Uses cookiecutter templates for project structure
- SDK Management: Leverages Briefcase's Android SDK manager for tools
- Python 3.13 Support: Automatically applies compatibility patches to pyjnius 1.6.1 when using Python 3.13+
- APK Generation: Runs python-for-android with appropriate arguments and handles APK output
Requirements
- Python 3.8+
- Briefcase 0.3.23+
- Linux (tested on Ubuntu 25.04+)
Configuration Options
Basic Configuration
[tool.briefcase.app.yourapp.android]
# Required: Use P4A backend
build_backend = "briefcase_p4a_backend"
Advanced Options
[tool.briefcase.app.yourapp.android]
build_backend = "briefcase_p4a_backend"
# Target architectures (defaults to armeabi-v7a, arm64-v8a)
android_archs = ["arm64-v8a"]
# API levels
android_sdk_version = "33"
android_min_sdk_version = "21"
# Custom Android activity (optional)
android_activity = "org.kivy.android.PythonActivity"
Python 3.13 Compatibility
For Python 3.13+, this backend automatically:
- Uses local pyjnius recipe with compatibility patches applied to stable version 1.6.1
- Patches are based on official pyjnius GitHub commit for Python 3.13
longtype fixes - No manual intervention required - patches apply automatically when needed
Troubleshooting
Common Issues
"APK not found after build" The backend searches multiple locations for the generated APK. Check build logs for details.
Debug Commands
# Verbose build
briefcase build android p4a -v
# Clean build
briefcase build android p4a --clean
Supported frameworks
- Kivy: Full support with kivy>=2.3.1
- Other Frameworks: Any Python framework compatible with python-for-android
Development
# Clone and install
git clone https://github.com/pyCino/briefcase-p4a-backend.git
cd briefcase-p4a-backend
pip install -e .
# Test with sample app
briefcase new # Create test project
# Add build_backend = "briefcase_p4a_backend" to pyproject.toml
briefcase create android p4a
briefcase build android p4a
Related Projects
- Briefcase - Cross-platform Python app packaging
- Python-for-Android - Android build system
- Kivy - Cross-platform GUI framework
License
MIT License - see LICENSE file for details.
Al pyCino - Simplifying Android development with Python
Metadata
Release files for briefcase-p4a-backend 1.0.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| briefcase_p4a_backend-1.0.0.post1.tar.gz | 14.5 kB | Without provenance | Details for briefcase_p4a_backend-1.0.0.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| briefcase_p4a_backend-1.0.0.post1-py3-none-any.whl | Python 3 | none | any | Details for briefcase_p4a_backend-1.0.0.post1-py3-none-any.whl |
Total release size: 27.5 kB
Release files / briefcase_p4a_backend-1.0.0.post1.tar.gz
| Download URL | briefcase_p4a_backend-1.0.0.post1.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
880a5bae48f6b38b3b17fe1fcbef3c0ebf21c1a12bfb1074f409b206ca7292d7
|
|
BLAKE2b-256 checksum How to use checksums |
27cd7cb4c3d862d59d3c1b6fa6ff6f1baf3eb09921cbdce66308419d63732016
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / briefcase_p4a_backend-1.0.0.post1-py3-none-any.whl
| Download URL | briefcase_p4a_backend-1.0.0.post1-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25bfce3cbacb35917b8d5e95a6374678dd015c4451b63dd22e3884ddf45a5c96
|
|
BLAKE2b-256 checksum How to use checksums |
eebf31833423b820f56408db21b23c5291e5ed8d6e8990411fe0d13341f8949b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for briefcase-p4a-backend 1.0.0.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.