-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Introduce FAQ #2917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Introduce FAQ #2917
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# FAQ for python-for-android (p4a) | ||
|
||
## Introduction | ||
|
||
[python-for-android](https://python-for-android.readthedocs.io/) is an open | ||
source build tool to let you package Python code into standalone android APKs. | ||
These can be passed around, installed, or uploaded to marketplaces such as the | ||
Play Store just like any other Android app. | ||
|
||
### Sibling Projects: | ||
|
||
This tool was originally developed for apps produced with | ||
the [Kivy framework](https://github.com/kivy/kivy), and is | ||
managed by the same team. However, it can be used to build other types of Python | ||
apps for Android. | ||
|
||
p4a is often used in conjunction | ||
with [Buildozer](https://github.com/kivy/buildozer), which can download, install | ||
and keep up-to-date any necessary prerequisites (including p4a itself), for a | ||
number of target platforms, using a specification file to define the build. | ||
|
||
### Is it possible to have a kiosk app on Android? | ||
|
||
Thomas Hansen wrote a detailed answer | ||
on [the kivy-users mailing list](https://groups.google.com/d/msg/kivy-users/QKoCekAR1c0/yV-85Y_iAwoJ) | ||
|
||
Basically, you need to root the device, remove the SystemUI package, add some | ||
lines to the xml configuration, and you're done. | ||
|
||
### Common Errors | ||
|
||
The following are common problems and resolutions that users have reported. | ||
|
||
#### AttributeError: ‘AnsiCodes’ object has no attribute ‘LIGHTBLUE_EX’ | ||
|
||
This occurs if your version of `colorama` is too low, install version 0.3.3 or | ||
higher. | ||
|
||
If you install python-for-android with pip or via setup.py, this dependency | ||
should be taken care of automatically. | ||
Julian-O marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### AttributeError: ‘Context’ object has no attribute ‘hostpython’ | ||
|
||
This is a known bug in some releases. To work around it, add your python | ||
requirement explicitly, e.g. `--requirements=python3,kivy`. This also applies | ||
when using buildozer, in which case add python3 to your buildozer.spec | ||
requirements. | ||
|
||
#### linkname too long | ||
|
||
This can happen when you try to include a very long filename, which doesn’t | ||
normally happen but can occur accidentally if the p4a directory contains a | ||
`.buildozer` directory that is not excluded from the build (e.g. if buildozer | ||
was previously used). Removing this directory should fix the problem, and is | ||
desirable anyway since you don’t want it in the APK. | ||
|
||
#### Requested API target 19 is not available, install it with the SDK android tool | ||
|
||
This means that your SDK is missing the required platform tools. You need to | ||
install the `platforms;android-19` package in your SDK, using the android or | ||
sdkmanager tools (depending on SDK version). | ||
|
||
If using buildozer this should be done automatically, but as a workaround you | ||
can run these from `~/.buildozer/android/platform/android-sdk-20/tools/android`. | ||
Julian-O marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### ModuleNotFoundError: No module named ‘_ctypes’ | ||
|
||
You do not have the libffi headers available to python-for-android, so you need | ||
to install them. On Ubuntu and derivatives these come from the `libffi-dev` | ||
package. | ||
|
||
After installing the headers, clean the build (p4a clean builds, or with | ||
buildozer delete the .buildozer directory within your app directory) and run | ||
python-for-android again. | ||
Julian-O marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”) | ||
Your hostpython3 was compiled without SSL support. You need to install the SSL | ||
development files before rebuilding the hostpython3 recipe. Remember to always | ||
clean the build before rebuilding (`p4a clean builds`, or with buildozer `buildozer | ||
android clean`). | ||
|
||
On Ubuntu and derivatives: | ||
|
||
apt install libssl-dev | ||
p4a clean builds # or with: buildozer `buildozer android clean | ||
|
||
On macOS: | ||
|
||
brew install openssl | ||
sudo ln -sfn /usr/local/opt/openssl /usr/local/ssl | ||
Julian-O marked this conversation as resolved.
Show resolved
Hide resolved
|
||
p4a clean builds # or with: buildozer `buildozer android clean |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.