Buildozer 编译失败:找不到应用程序项目目录?

Buildozer compilation failed: Could not find application project directory?

我是 kivy 的新手,当我尝试编译 buildozer 时出现错误。 第一个错误是关于下载 食谱。我手动下载了这些包,我也在 buildozer.spec 文件中定义了它们的路径:

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = kivy,hostpython2,python2,six,pyjnius,kivy,sdl2_image

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
requirements.source.hostpython2 = ~/.buildozer/hostpython2
requirements.source.python2 = ~/.buildozer/python2
requirements.source.six = ~/.buildozer/six
requirements.source.pyjnius = ~/.buildozer/pyjnius
requirements.source.kivy = ~/.buildozer/kivy
requirements.source.sdl2_image = ~/.buildozer/sdl2_image

然后,我重新编译:

sudo buildozer -v android debug

然而过了一会儿我看到了一个不同的错误:

  STDOUT:
Android NDK: Could not find application project directory !    
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.    
/home/tanberk/.buildozer/android/platform/android-ndk-r9c/build/core/build-local.mk:148: *** Android NDK: Aborting    .  Stop.


  STDERR:

# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy,hostpython2,python2,six,pyjnius,kivy,sdl2_image --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/tanberk/İndirilenler/.buildozer/android/platform/build
# 
# 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

谁能帮我解决这个问题?

提前致谢。

OS: Ubuntu 17.04

Python: 3.5.2

编辑 1:

@ikolim

我尝试按照步骤操作,现在错误类型是 UnicodeError。

输出中有警告。

[WARNING]: NDK version was set as r10.3.2, but checking the NDK dir claims it is 10.3.2, or should i download version **r8**?
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.

我该怎么办,是否有与 10.3.2 不同的 r10.3.2 版本?或者我应该下载版本 r8?

整个输出如下。

tanberk@kutlu:~/İndirilenler$ buildozer android debug deploy run
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' paket yönetim programı sürüm 1.18.10 (amd64).
Bu bir özgür yazılımdır; kopyalama şartları için GNU Genel Kamu Lisansı
sürüm 2 ya da daha yenisine bakın. Hiçbir garanti verilmez.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /usr/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Install platform
# Run 'pip install -q --user "appdirs" "colorama>=0.3.3" "sh>=1.10,<1.12.5" "jinja2" "six"'
# Cwd None
# Apache ANT found at /home/tanberk/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/tanberk/.buildozer/android/platform/android-sdk-20
# Android NDK found at /opt/crystax-ndk-10.3.2
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3crystax,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/tanberk/\xc4\xb0ndirilenler/.buildozer/android/platform/build'
# Cwd /home/tanberk/İndirilenler/.buildozer/android/platform/python-for-android-master
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI
[INFO]:    Available Android APIs are (19)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK
[INFO]:    Got NDK version from $ANDROIDNDKVER
[WARNING]: NDK version was set as r10.3.2, but checking the NDK dir claims it is 10.3.2.
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.
[INFO]:    Using Crystax NDK r10.3.2
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[INFO]:    No existing dists meet the given requirements!
[INFO]:    No dist exists that meets your requirements, so one will be built.
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/tanberk/İndirilenler/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 916, in <module>
    main()
  File "/home/tanberk/İndirilenler/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 913, in main
    ToolchainCL()
  File "/home/tanberk/İndirilenler/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 514, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/tanberk/İndirilenler/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 147, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/tanberk/İndirilenler/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 169, in build_dist_from_args
    = get_recipe_order_and_bootstrap(ctx, dist.recipes, bs)
  File "pythonforandroid/graph.py", line 113, in get_recipe_order_and_bootstrap
    name, ctx, orders=new_possible_orders)
  File "pythonforandroid/graph.py", line 36, in recursively_collect_orders
    recipe = Recipe.get_recipe(name, ctx)
  File "pythonforandroid/recipe.py", line 629, in get_recipe
    recipe_file = join(recipes_dir, name, '__init__.py')
  File "/usr/lib/python2.7/posixpath.py", line 73, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 14: ordinal not in range(128)
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3crystax,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/tanberk/İndirilenler/.buildozer/android/platform/build
# 
# 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
tanberk@kutlu:~/İndirilenler$ 

当我查看 #Command Failed: 时,我怀疑该程序使用 python2 而不是 python3 运行?

编辑 2:

我换了目录,还是报错

下面是新的错误信息。

tanberk@kutlu:~/Android$ buildozer android debug deploy run
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' paket yönetim programı sürüm 1.18.10 (amd64).
Bu bir özgür yazılımdır; kopyalama şartları için GNU Genel Kamu Lisansı
sürüm 2 ya da daha yenisine bakın. Hiçbir garanti verilmez.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /usr/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Install platform
# Run 'pip install -q --user "appdirs" "colorama>=0.3.3" "sh>=1.10,<1.12.5" "jinja2" "six"'
# Cwd None
# Apache ANT found at /home/tanberk/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/tanberk/.buildozer/android/platform/android-sdk-20
# Android NDK found at /opt/crystax-ndk-10.3.2
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=hostpython3crystax,python3crystax,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/tanberk/Android/.buildozer/android/platform/build'
# Cwd /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI
[INFO]:    Available Android APIs are (19)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK
[INFO]:    Got NDK version from $ANDROIDNDKVER
[WARNING]: NDK version was set as r10.3.2, but checking the NDK dir claims it is 10.3.2.
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.
[INFO]:    Using Crystax NDK r10.3.2
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[INFO]:    No existing dists meet the given requirements!
[INFO]:    No dist exists that meets your requirements, so one will be built.
[INFO]:    Found a single valid recipe set: [u'hostpython3crystax', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', u'python3crystax', 'sdl2', 'six', 'pyjnius', u'kivy']
[INFO]:    The selected bootstrap is sdl2
[INFO]:    # Creating dist with sdl2 bootstrap
[INFO]:    Dist will have name myapp and recipes (hostpython3crystax, python3crystax, kivy)
[INFO]:    Dist will also contain modules () installed from pip
[INFO]:    -> running cp -r /home/tanberk/Android/.b...(and 189 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python3crystax
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Recipe build order is [u'hostpython3crystax', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', u'python3crystax', 'sdl2', 'six', 'pyjnius', u'kivy']
[INFO]:    # Downloading recipes 
[INFO]:    Downloading hostpython3crystax
[INFO]:    Skipping hostpython3crystax download as no URL is set
[INFO]:    Downloading sdl2_image
[INFO]:    -> running mkdir -p /home/tanberk/Android...(and 54 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/packages/sdl2_image
[INFO]:    -> running basename https://www.libsdl.or...(and 52 more)
[INFO]:    sdl2_image download already cached, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Downloading sdl2_mixer
[INFO]:    -> running mkdir -p /home/tanberk/Android...(and 54 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/packages/sdl2_mixer
[INFO]:    -> running basename https://www.libsdl.or...(and 52 more)
[INFO]:    sdl2_mixer download already cached, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Downloading sdl2_ttf
[INFO]:    -> running mkdir -p /home/tanberk/Android...(and 52 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/packages/sdl2_ttf
[INFO]:    -> running basename https://www.libsdl.org...(and 48 more)
[INFO]:    sdl2_ttf download already cached, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Downloading python3crystax
[INFO]:    -> running mkdir -p /home/tanberk/Android...(and 58 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/packages/python3crystax
[INFO]:    -> running basename 
[INFO]:    -> running rm -f .mark-
[INFO]:    -> running touch .mark-
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Downloading sdl2
[INFO]:    -> running mkdir -p /home/tanberk/Android/...(and 47 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/packages/sdl2
[INFO]:    -> running basename https://www.libsdl.org...(and 26 more)
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Downloading six
[INFO]:    -> running mkdir -p /home/tanberk/Android/...(and 46 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/packages/six
[INFO]:    -> running basename https://pypi.python.or...(and 40 more)
[INFO]:    six download already cached, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Downloading pyjnius
[INFO]:    -> running mkdir -p /home/tanberk/Android...(and 51 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/packages/pyjnius
[INFO]:    -> running basename https://github.com/kiv...(and 28 more)
[INFO]:    pyjnius download already cached, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Downloading kivy
[INFO]:    -> running mkdir -p /home/tanberk/Android/...(and 47 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/packages/kivy
[INFO]:    -> running basename https://github.com/kiv...(and 25 more)
     [INFO]:    kivy download already cached, skipping                         
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    # Building all recipes for arch armeabi-v7a
[INFO]:    # Unpacking recipes
[INFO]:    Unpacking hostpython3crystax for armeabi-v7a
[INFO]:    Skipping hostpython3crystax unpack as no URL is set
[INFO]:    Unpacking sdl2_image for armeabi-v7a
[INFO]:    -> running basename https://www.libsdl.or...(and 52 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python3crystax/jni
[INFO]:    sdl2_image is already unpacked, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Unpacking sdl2_mixer for armeabi-v7a
[INFO]:    -> running basename https://www.libsdl.or...(and 52 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python3crystax/jni
[INFO]:    sdl2_mixer is already unpacked, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Unpacking sdl2_ttf for armeabi-v7a
[INFO]:    -> running basename https://www.libsdl.org...(and 48 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python3crystax/jni
[INFO]:    sdl2_ttf is already unpacked, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Unpacking python3crystax for armeabi-v7a
[INFO]:    -> running basename 
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/other_builds/python3crystax-version3.5/armeabi-v7a
[INFO]:    python3crystax is already unpacked, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Unpacking sdl2 for armeabi-v7a
[INFO]:    -> running basename https://www.libsdl.org...(and 26 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python3crystax/jni
[INFO]:    sdl2 is already unpacked, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Unpacking six for armeabi-v7a
[INFO]:    -> running basename https://pypi.python.or...(and 40 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/other_builds/six-python3crystax/armeabi-v7a
[INFO]:    six is already unpacked, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Unpacking pyjnius for armeabi-v7a
[INFO]:    -> running basename https://github.com/kiv...(and 28 more)
           work[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/other_builds/pyjnius-python3crystax-sdl2/armeabi-v7a
[INFO]:    pyjnius is already unpacked, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Unpacking kivy for armeabi-v7a
[INFO]:    -> running basename https://github.com/kiv...(and 25 more)
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/other_builds/kivy-python3crystax-sdl2/armeabi-v7a
[INFO]:    kivy is already unpacked, skipping
[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    # Prebuilding recipes
[INFO]:    Prebuilding hostpython3crystax for armeabi-v7a
[INFO]:    hostpython3crystax has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding sdl2_image for armeabi-v7a
[INFO]:    sdl2_image has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for sdl2_image[armeabi-v7a]
[INFO]:    sdl2_image already patched, skipping
[INFO]:    Prebuilding sdl2_mixer for armeabi-v7a
[INFO]:    sdl2_mixer has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for sdl2_mixer[armeabi-v7a]
[INFO]:    sdl2_mixer already patched, skipping
[INFO]:    Prebuilding sdl2_ttf for armeabi-v7a
[INFO]:    sdl2_ttf has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding python3crystax for armeabi-v7a
[INFO]:    python3crystax has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding sdl2 for armeabi-v7a
[INFO]:    sdl2 has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for sdl2[armeabi-v7a]
[INFO]:    sdl2 already patched, skipping
[INFO]:    Prebuilding six for armeabi-v7a
[INFO]:    six has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding pyjnius for armeabi-v7a
[INFO]:    pyjnius has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for pyjnius[armeabi-v7a]
[INFO]:    pyjnius already patched, skipping
[INFO]:    Prebuilding kivy for armeabi-v7a
[INFO]:    kivy has no prebuild_armeabi_v7a, skipping
[INFO]:    # Building recipes
[INFO]:    Building hostpython3crystax for armeabi-v7a
[INFO]:    Building sdl2_image for armeabi-v7a
[INFO]:    Building sdl2_mixer for armeabi-v7a
[INFO]:    Building sdl2_ttf for armeabi-v7a
[INFO]:    Building python3crystax for armeabi-v7a
[INFO]:    Building sdl2 for armeabi-v7a
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python3crystax/jni
[INFO]:    -> running ndk-build V=1
           working: /opt/crystax-ndk-10.3.2/t[INFO]:    <- directory context /home/tanberk/Android/.buildozer/android/platform/python-for-android-master
[INFO]:    Building six for armeabi-v7a
[INFO]:    six apparently isn't already in site-packages
[INFO]:    Installing six into site-packages
[INFO]:    -> directory context /home/tanberk/Android/.buildozer/android/platform/build/build/other_builds/six-python3crystax/armeabi-v7a/six
[INFO]:    -> running python3.5 setup.py install -O2...(and 107 more)
           working:     addsitedir(sitedir, known_paths)    Exception in thread background thread for pid 11620:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/tanberk/.local/lib/python2.7/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/home/tanberk/.local/lib/python2.7/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/tanberk/.local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_1: 

  RAN: /usr/bin/python3.5 setup.py install -O2 --root=/home/tanberk/Android/.buildozer/android/platform/build/build/python-installs/myapp --install-lib=.

  STDOUT:
Failed to import the site module
Traceback (most recent call last):
  File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
  File "/usr/lib/python3.5/site.py", line 567, in main
    known_paths = addsitepackages(known_paths)
  File "/usr/lib/python3.5/site.py", line 344, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/usr/lib/python3.5/site.py", line 212, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/usr/lib/python3.5/site.py", line 168, in addpackage
    for n, line in enumerate(f):
  File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 14: ordinal not in range(128)


  STDERR:


Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/tanberk/Android/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 916, in <module>
    main()
  File "/home/tanberk/Android/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 913, in main
    ToolchainCL()
  File "/home/tanberk/Android/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 514, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/tanberk/Android/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 147, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/tanberk/Android/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 192, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "pythonforandroid/build.py", line 572, in build_recipes
  File "pythonforandroid/recipe.py", line 806, in build_arch
  File "pythonforandroid/recipe.py", line 839, in install_python_package
  File "pythonforandroid/logger.py", line 175, in shprint
  File "/home/tanberk/.local/lib/python2.7/site-packages/sh.py", line 720, in next
    self.wait()
  File "/home/tanberk/.local/lib/python2.7/site-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/tanberk/.local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /usr/bin/python3.5 setup.py install -O2 --root=/home/tanberk/Android/.buildozer/android/platform/build/build/python-installs/myapp --install-lib=.

  STDOUT:
Failed to import the site module
Traceback (most recent call last):
  File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
  File "/usr/lib/python3.5/site.py", line 567, in main
    known_paths = addsitepackages(known_paths)
  File "/usr/lib/python3.5/site.py", line 344, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/usr/lib/python3.5/site.py", line 212, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/usr/lib/python3.5/site.py", line 168, in addpackage
    for n, line in enumerate(f):
  File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 14: ordinal not in range(128)


  STDERR:

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=hostpython3crystax,python3crystax,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/tanberk/Android/.buildozer/android/platform/build
# 
# 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
tanberk@kutlu:~/Android$ 

我能够 运行 buildozer 成功。我正在使用 Ubuntu 16.04 LTS、Kivy 1.10.0 和 Python 3.5。我做了以下事情:

安装带有 python3 支持的 Buildozer:

  1. 从源安装 buildozer:

    git 克隆 https://github.com/kivy/buildozer
    cd buildozer
    python setup.py 构建
    须藤 pip 安装 -e 。

  2. 在某处下载并解压 Crystax NDK(/opt/crystax-ndk 是一种选择):https://www.crystax.net/en/download

  3. 安装 Cython(来自 /usr/local/lib/python3.5/dist-packages 的 pip 9.0.1)

    sudo pip install --upgrade cython==0.26

  4. 进入您的应用程序目录并通过执行创建 buildozer.spec 文件:

    buildozer 初始化

  5. 编辑 buildozer.spec 文件并确保以下行位于:

    # 需要 python3水晶:
    要求=主机python3,python3crystax,kivy
    ...
    # 使用的 Kivy 版本
    osx.kivy_version = 1.10.0
    ...
    # (str) Android 要使用的 NDK 版本
    android.ndk = 10.3.2
    ...
    # (str) Android NDK目录(如果为空,会自动下载。)
    android.ndk_path = /opt/crystax-ndk-10.3.2

  6. 最后,在您的 phone:

    上构建、部署和 运行 应用程序

    buildozer android 调试部署 运行

  7. 如果第一次失败,执行以下:

    buildozer android 清理调试部署 运行

备注

请针对 hello world 应用程序尝试 buildozer (Kivy Basics - minimal application)。

输出