Skip to content

Latest commit

 

History

History
103 lines (75 loc) · 3.56 KB

File metadata and controls

103 lines (75 loc) · 3.56 KB

Troubleshooting

Debug output

Add the --debug option to any python-for-android command to see full debug output including the output of all the external tools used in the compilation and packaging steps.

If reporting a problem by email or irc, it is usually helpful to include this full log, via e.g. a pastebin or Github gist.

Getting help

python-for-android is managed by the Kivy Organisation, and you can get help with any problems using the same channels as Kivy itself:

If you find a bug, you can also post an issue on the python-for-android Github page.

Debugging on Android

When a python-for-android APK doesn't work, often the only indication that you get is that it closes. It is important to be able to find out what went wrong.

python-for-android redirects Python's stdout and stderr to the Android logcat stream. You can see this by enabling developer mode on your Android device, enabling adb on the device, connecting it to your PC (you should see a notification that USB debugging is connected) and running adb logcat. If adb is not in your PATH, you can find it at /path/to/Android/SDK/platform-tools/adb, or access it through python-for-android with the shortcut:

python-for-android logcat

or:

python-for-android adb logcat

Running logcat command gives a lot of information about what Android is doing. You can usually see important lines by using logcat's built in functionality to see only lines with the python tag (or just grepping this).

When your app crashes, you'll see the normal Python traceback here, as well as the output of any print statements etc. that your app runs. Use these to diagnose the problem just as normal.

The adb command passes its arguments straight to adb itself, so you can also do other debugging tasks such as python-for-android adb devices to get the list of connected devices.

For further information, see the Android docs on adb, and on logcat in particular.

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.

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=python2,kivy. This also applies when using buildozer, in which case add python2 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.