[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet.
[WARNING]: Please report any issues to the python-for-android issue tracker.
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet.
[WARNING]: Please report any issues to the python-for-android issue tracker.
usage: toolchain.py aab [-h] [--debug] [--color {always,never,auto}]
[--sdk-dir SDK_DIR] [--ndk-dir NDK_DIR]
[--android-api ANDROID_API]
[--ndk-version NDK_VERSION] [--ndk-api NDK_API]
[--symlink-bootstrap-files]
[--storage-dir STORAGE_DIR] [--arch ARCH]
[--dist-name DIST_NAME] [--requirements REQUIREMENTS]
[--recipe-blacklist RECIPE_BLACKLIST]
[--blacklist-requirements BLACKLIST_REQUIREMENTS]
[--bootstrap BOOTSTRAP] [--hook HOOK] [--force-build]
[--no-force-build] [--require-perfect-match]
[--no-require-perfect-match] [--allow-replace-dist]
[--no-allow-replace-dist]
[--local-recipes LOCAL_RECIPES]
[--activity-class-name ACTIVITY_CLASS_NAME]
[--service-class-name SERVICE_CLASS_NAME]
[--java-build-tool {auto,ant,gradle}] [--copy-libs]
[--no-copy-libs] [--add-asset ASSETS]
[--add-resource RESOURCES] [--private PRIVATE]
[--use-setup-py] [--ignore-setup-py] [--release]
[--with-debug-symbols] [--keystore KEYSTORE]
[--signkey SIGNKEY] [--keystorepw KEYSTOREPW]
[--signkeypw SIGNKEYPW]
options:
-h, --help show this help message and exit
--debug Display debug output and all build info
--color {always,never,auto}
Enable or disable color output (default enabled on
tty)
--sdk-dir SDK_DIR, --sdk_dir SDK_DIR
The filepath where the Android SDK is installed
--ndk-dir NDK_DIR, --ndk_dir NDK_DIR
The filepath where the Android NDK is installed
--android-api ANDROID_API, --android_api ANDROID_API
The Android API level to build against defaults to 33
if not specified.
--ndk-version NDK_VERSION, --ndk_version NDK_VERSION
DEPRECATED: the NDK version is now found automatically
or not at all.
--ndk-api NDK_API The Android API level to compile against. This should
be your minimal supported API, not normally the same
as your --android-api. Defaults to min(ANDROID_API,
21) if not specified.
--symlink-bootstrap-files, --ssymlink_bootstrap_files
If True, symlinks the bootstrap files creation. This
is useful for development only, it could also cause
weird problems.
--storage-dir STORAGE_DIR
Primary storage directory for downloads and builds
(default: /home/lastcode/.local/share/python-for-
android)
--arch ARCH The archs to build for.
--dist-name DIST_NAME, --dist_name DIST_NAME
The name of the distribution to use or create
--requirements REQUIREMENTS
Dependencies of your app, should be recipe names or
Python modules. NOT NECESSARY if you are using Python
3 with --use-setup-py
--recipe-blacklist RECIPE_BLACKLIST
Blacklist an internal recipe from use. Allows
disabling Python 3 core modules to save size
--blacklist-requirements BLACKLIST_REQUIREMENTS
Blacklist an internal recipe from use. Allows
disabling Python 3 core modules to save size
--bootstrap BOOTSTRAP
The bootstrap to build with. Leave unset to choose
automatically.
--hook HOOK Filename to a module that contains python-for-android
hooks
--local-recipes LOCAL_RECIPES, --local_recipes LOCAL_RECIPES
Directory to look for local recipes
--activity-class-name ACTIVITY_CLASS_NAME
The full java class name of the main activity
--service-class-name SERVICE_CLASS_NAME
Full java package name of the PythonService class
--java-build-tool {auto,ant,gradle}
The java build tool to use when packaging the APK,
defaults to automatically selecting an appropriate
tool.
--add-asset ASSETS Put this in the assets folder in the apk.
--add-resource RESOURCES
Put this in the res folder in the apk.
--private PRIVATE the directory with the app source code files
(containing your main.py entrypoint)
--use-setup-py Process the setup.py of a project if present.
(Experimental!
--ignore-setup-py Don't run the setup.py of a project if present. This
may be required if the setup.py is not designed to
work inside p4a (e.g. by installing dependencies that
won't work or aren't desired on Android
--release Build your app as a non-debug release build. (Disables
gdb debugging among other things)
--with-debug-symbols Will keep debug symbols from .so files.
--keystore KEYSTORE Keystore for JAR signing key, will use jarsigner
default if not specified (release build only)
--signkey SIGNKEY Key alias to sign PARSER_APK. with (release build
only)
--keystorepw KEYSTOREPW
Password for keystore
--signkeypw SIGNKEYPW
Password for key alias
Whether to force compilation of a new distribution
--force-build
--no-force-build (this is the default)
--require-perfect-match
--no-require-perfect-match
(this is the default)
--allow-replace-dist (this is the default)
--no-allow-replace-dist
--copy-libs
--no-copy-libs (this is the default)
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet.
[WARNING]: Please report any issues to the python-for-android issue tracker.
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet.
[WARNING]: Please report any issues to the python-for-android issue tracker.
[INFO]: Recipe kivy: version "2.0.0" requested
[INFO]: Recipe kivymd: version "0.104.2" requested
[INFO]: Recipe kaki: version "0.1.5" requested
[INFO]: Recipe pillow: version "9.2.0" requested
[INFO]: Recipe plyer: version "2.0.0" requested
[INFO]: Recipe arabic-reshaper: version "2.1.3" requested
[INFO]: Recipe python-bidi: version "0.4.2" requested
[INFO]: Will compile for the following archs: arm64-v8a, armeabi-v7a
[INFO]: Found Android API target in $ANDROIDAPI: 31
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1312, in
main()
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
ToolchainCL()
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 734, in init
getattr(self, command)(args)
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 143, in wrapper_func
ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 273, in prepare_build_environment
apis = get_available_apis(self.sdk_dir)
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 47, in get_available_apis
targets = get_targets(sdk_dir)
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 35, in get_targets
targets = avdmanager('list', 'target').stdout.split('\n')
AttributeError: 'str' object has no attribute 'stdout'
I ran into the same problem, you need to go to the python-for-android/pythonforandroid/build.py file, and manully delete the '.stdout.decode('utf-8') part.
Checklist
p4a.branch = develop
)Versions
Description
while building kivy app with buildozer ,python-for-android originated this issue with get_targets function in build.py file
buildozer.spec
Command:
Spec file:
Check configuration tokens
Ensure build layout
Check configuration tokens
Preparing build
Check requirements for android
Search for Git (git)
-> found at /usr/bin/git
Search for Cython (cython)
-> found at /home/lastcode/.local/bin/cython
Search for Java compiler (javac)
-> found at /usr/lib/jvm/java-17-openjdk-amd64/bin/javac
Search for Java keytool (keytool)
-> found at /usr/lib/jvm/java-17-openjdk-amd64/bin/keytool
Install platform
Run ['git', 'config', '--get', 'remote.origin.url']
Cwd /mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
Run ['git', 'branch', '-vv']
Cwd /mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android
Run ['/usr/bin/python3', '-m', 'pip', 'install', '-q', '--user', 'appdirs', 'colorama>=0.3.3', 'jinja2', 'sh>=1.10; sys_platform!="nt"', 'pep517', 'toml', 'packaging']
Cwd None
Apache ANT found at /home/lastcode/.buildozer/android/platform/apache-ant-1.9.4
Android SDK found at /home/lastcode/.buildozer/android/platform/android-sdk
Recommended android's NDK version by p4a is: 25b
Android NDK found at /home/lastcode/.buildozer/android/platform/android-ndk-r25b
Run ['/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'aab', '-h', '--color=always', '--storage-dir=/mnt/m/coding/#1python/app_export/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
Cwd /mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet. [WARNING]: Please report any issues to the python-for-android issue tracker. [WARNING]: prerequisites.py is experimental and does not support all prerequisites yet. [WARNING]: Please report any issues to the python-for-android issue tracker. usage: toolchain.py aab [-h] [--debug] [--color {always,never,auto}] [--sdk-dir SDK_DIR] [--ndk-dir NDK_DIR] [--android-api ANDROID_API] [--ndk-version NDK_VERSION] [--ndk-api NDK_API] [--symlink-bootstrap-files] [--storage-dir STORAGE_DIR] [--arch ARCH] [--dist-name DIST_NAME] [--requirements REQUIREMENTS] [--recipe-blacklist RECIPE_BLACKLIST] [--blacklist-requirements BLACKLIST_REQUIREMENTS] [--bootstrap BOOTSTRAP] [--hook HOOK] [--force-build] [--no-force-build] [--require-perfect-match] [--no-require-perfect-match] [--allow-replace-dist] [--no-allow-replace-dist] [--local-recipes LOCAL_RECIPES] [--activity-class-name ACTIVITY_CLASS_NAME] [--service-class-name SERVICE_CLASS_NAME] [--java-build-tool {auto,ant,gradle}] [--copy-libs] [--no-copy-libs] [--add-asset ASSETS] [--add-resource RESOURCES] [--private PRIVATE] [--use-setup-py] [--ignore-setup-py] [--release] [--with-debug-symbols] [--keystore KEYSTORE] [--signkey SIGNKEY] [--keystorepw KEYSTOREPW] [--signkeypw SIGNKEYPW]
options: -h, --help show this help message and exit --debug Display debug output and all build info --color {always,never,auto} Enable or disable color output (default enabled on tty) --sdk-dir SDK_DIR, --sdk_dir SDK_DIR The filepath where the Android SDK is installed --ndk-dir NDK_DIR, --ndk_dir NDK_DIR The filepath where the Android NDK is installed --android-api ANDROID_API, --android_api ANDROID_API The Android API level to build against defaults to 33 if not specified. --ndk-version NDK_VERSION, --ndk_version NDK_VERSION DEPRECATED: the NDK version is now found automatically or not at all. --ndk-api NDK_API The Android API level to compile against. This should be your minimal supported API, not normally the same as your --android-api. Defaults to min(ANDROID_API, 21) if not specified. --symlink-bootstrap-files, --ssymlink_bootstrap_files If True, symlinks the bootstrap files creation. This is useful for development only, it could also cause weird problems. --storage-dir STORAGE_DIR Primary storage directory for downloads and builds (default: /home/lastcode/.local/share/python-for- android) --arch ARCH The archs to build for. --dist-name DIST_NAME, --dist_name DIST_NAME The name of the distribution to use or create --requirements REQUIREMENTS Dependencies of your app, should be recipe names or Python modules. NOT NECESSARY if you are using Python 3 with --use-setup-py --recipe-blacklist RECIPE_BLACKLIST Blacklist an internal recipe from use. Allows disabling Python 3 core modules to save size --blacklist-requirements BLACKLIST_REQUIREMENTS Blacklist an internal recipe from use. Allows disabling Python 3 core modules to save size --bootstrap BOOTSTRAP The bootstrap to build with. Leave unset to choose automatically. --hook HOOK Filename to a module that contains python-for-android hooks --local-recipes LOCAL_RECIPES, --local_recipes LOCAL_RECIPES Directory to look for local recipes --activity-class-name ACTIVITY_CLASS_NAME The full java class name of the main activity --service-class-name SERVICE_CLASS_NAME Full java package name of the PythonService class --java-build-tool {auto,ant,gradle} The java build tool to use when packaging the APK, defaults to automatically selecting an appropriate tool. --add-asset ASSETS Put this in the assets folder in the apk. --add-resource RESOURCES Put this in the res folder in the apk. --private PRIVATE the directory with the app source code files (containing your main.py entrypoint) --use-setup-py Process the setup.py of a project if present. (Experimental! --ignore-setup-py Don't run the setup.py of a project if present. This may be required if the setup.py is not designed to work inside p4a (e.g. by installing dependencies that won't work or aren't desired on Android --release Build your app as a non-debug release build. (Disables gdb debugging among other things) --with-debug-symbols Will keep debug symbols from
.so
files. --keystore KEYSTORE Keystore for JAR signing key, will use jarsigner default if not specified (release build only) --signkey SIGNKEY Key alias to sign PARSER_APK. with (release build only) --keystorepw KEYSTOREPW Password for keystore --signkeypw SIGNKEYPW Password for key aliasWhether to force compilation of a new distribution
--force-build --no-force-build (this is the default) --require-perfect-match --no-require-perfect-match (this is the default) --allow-replace-dist (this is the default) --no-allow-replace-dist --copy-libs --no-copy-libs (this is the default)
Check application requirements
Compile platform
Run ['/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=myapp', '--bootstrap=sdl2', '--requirements=python3,kivy==2.0.0,kivymd==0.104.2,kaki==0.1.5,pillow==9.2.0,plyer==2.0.0,android,arabic-reshaper==2.1.3,python-bidi==0.4.2', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/mnt/m/coding/#1python/app_export/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
Cwd /mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android
[WARNING]: prerequisites.py is experimental and does not support all prerequisites yet. [WARNING]: Please report any issues to the python-for-android issue tracker. [WARNING]: prerequisites.py is experimental and does not support all prerequisites yet. [WARNING]: Please report any issues to the python-for-android issue tracker. [INFO]: Recipe kivy: version "2.0.0" requested [INFO]: Recipe kivymd: version "0.104.2" requested [INFO]: Recipe kaki: version "0.1.5" requested [INFO]: Recipe pillow: version "9.2.0" requested [INFO]: Recipe plyer: version "2.0.0" requested [INFO]: Recipe arabic-reshaper: version "2.1.3" requested [INFO]: Recipe python-bidi: version "0.4.2" requested [INFO]: Will compile for the following archs: arm64-v8a, armeabi-v7a [INFO]: Found Android API target in $ANDROIDAPI: 31 Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1312, in
main()
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
ToolchainCL()
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 734, in init
getattr(self, command)(args)
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 143, in wrapper_func
ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 273, in prepare_build_environment
apis = get_available_apis(self.sdk_dir)
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 47, in get_available_apis
targets = get_targets(sdk_dir)
File "/mnt/m/coding/#1python/app_export/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 35, in get_targets
targets = avdmanager('list', 'target').stdout.split('\n')
AttributeError: 'str' object has no attribute 'stdout'
Command failed: ['/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=myapp', '--bootstrap=sdl2', '--requirements=python3,kivy==2.0.0,kivymd==0.104.2,kaki==0.1.5,pillow==9.2.0,plyer==2.0.0,android,arabic-reshaper==2.1.3,python-bidi==0.4.2', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/mnt/m/coding/#1python/app_export/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
ENVIRONMENT:
SHELL = '/bin/bash'
WSL_DISTRO_NAME = 'Ubuntu'
NAME = 'DESKTOP-SM64PEG'
PWD = '/mnt/m/coding/#1python/app_export'
LOGNAME = 'lastcode'
HOME = '/home/lastcode'
LANG = 'C.UTF-8'
LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.webp=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:.xspf=00;36:'
LESSCLOSE = '/usr/bin/lesspipe %s %s'
TERM = 'xterm-256color'
LESSOPEN = '| /usr/bin/lesspipe %s'
USER = 'lastcode'
SHLVL = '1'
WSLENV = ''
XDG_DATA_DIRS = '/usr/local/share:/usr/share:/var/lib/snapd/desktop'
PATH = ('/home/lastcode/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/lastcode/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program '
'Files/Python311/Scripts/:/mnt/c/Program ' 'Files/Python311/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/msys64/mingw64/bin:/mnt/c/Program ' 'Files/scrcpy:/mnt/c/Users/familia/AppData/Roaming/Python/Python311/Scripts:/mnt/c/Program ' 'Files/Git/cmd:/mnt/c/Users/familia/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/familia/AppData/Local/Programs/Microsoft ' 'VS Code/bin:/snap/bin:/home/lastcode/.local/bin/')
HOSTTYPE = 'x86_64'
_ = '/home/lastcode/.local/bin/buildozer'
PACKAGES_PATH = '/home/lastcode/.buildozer/android/packages'
ANDROIDSDK = '/home/lastcode/.buildozer/android/platform/android-sdk'
ANDROIDNDK = '/home/lastcode/.buildozer/android/platform/android-ndk-r25b'
ANDROIDAPI = '31'
ANDROIDMINAPI = '21'
#
Buildozer failed to execute the last command
The error might be hidden in the log above this error
Please read the full log, and search for it before
raising an issue with buildozer itself.
In case of a bug report, please add a full log with log_level = 2