android - 尝试使用 p4a 编译 "Hello World"Kivy 项目

标签 android python kivy

我不明白我的失败,现在我已经想不出我的错误可能是什么了。也许你可以帮忙。这是我尝试编译一个简单的“Hello World”Kivy Projekt 时得到的日志文件。

我已经在这个过程中处理了一些问题,但此时我对如何从中获取 apk 文件一无所知。

我正在使用命令:

 p4a apk --private /home/myname/Nextcloud/Kreativ/Python/Projekte/Kivy\ Test/ --package=org.example.myapp --name "Hallo World" --version 0.1 --bootrstrap=sd12 --requirements=python2,kivy --sdk_dir /home/myname/Android/Sdk/ --ndk_dir /home/myname/Android/Ndk/ --android_api 19 --ndk_version r17b --arch=armeabi-v7a

在虚拟环境中。 抱歉我的英语不好,我不是母语人士。

感谢您的帮助! 鲁弗斯!

Ps: 这是我在尝试编译时得到的日志文件。

[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Getting Android API version from user argument
[INFO]:    Available Android APIs are (19, 20, 21, 22, 23, 24, 25, 26, 27, 28)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Getting NDK dir from from user argument
[INFO]:    Got NDK version from from user argument
[INFO]:    Using Google NDK r17b
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    ccache is missing, the build will not be optimized in the future.
[INFO]:    Found the following toolchain versions: ['4.9']
[INFO]:    Picking the latest gcc toolchain, here 4.9
[INFO]:    No existing dists meet the given requirements!
[INFO]:    No dist exists that meets your requirements, so one will be built.
[INFO]:    Found multiple valid dependency orders:
[INFO]:        ['hostpython2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'python2', 'sdl2', 'six', 'pyjnius', 'kivy']
[INFO]:        ['hostpython2', 'pygame_bootstrap_components', 'python2', 'sdl', 'six', 'pygame', 'pyjnius', 'kivy']
[INFO]:    Using the first of these: ['hostpython2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'python2', 'sdl2', 'six', 'pyjnius', 'kivy']
[INFO]:    Trying to find a bootstrap that matches the given recipes.
[INFO]:    Found 1 acceptable bootstraps: ['sdl2_gradle']
[INFO]:    Using the first of these: sdl2_gradle
[INFO]:    Found a single valid recipe set: ['hostpython2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'python2', 'sdl2', 'six', 'pyjnius', 'kivy']
[INFO]:    The selected bootstrap is sdl2_gradle
[INFO]:    # Creating dist with sdl2_gradle bootstrap
[INFO]:    Dist will have name unnamed_dist_7 and recipes (python2, kivy)
[INFO]:    Dist will also contain modules () installed from pip
[INFO]:    -> running cp -r /home/rufus/kivyinstall...(and 155 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2
[INFO]:    <- directory context /home/rufus
[INFO]:    Recipe build order is ['hostpython2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'python2', 'sdl2', 'six', 'pyjnius', 'kivy']
[INFO]:    # Downloading recipes 
[INFO]:    Downloading hostpython2
[INFO]:    -> running mkdir -p /home/rufus/.local/sh...(and 43 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/packages/hostpython2
[INFO]:    -> running basename https://python.org/ftp...(and 34 more)
[INFO]:    hostpython2 download already cached, skipping                       
[INFO]:    <- directory context /home/rufus
[INFO]:    Downloading sdl2_image
[INFO]:    -> running mkdir -p /home/rufus/.local/sh...(and 42 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/packages/sdl2_image
[INFO]:    -> running basename https://www.libsdl.or...(and 52 more)
[INFO]:    sdl2_image download already cached, skipping                        
[INFO]:    <- directory context /home/rufus
[INFO]:    Downloading sdl2_mixer
[INFO]:    -> running mkdir -p /home/rufus/.local/sh...(and 42 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/packages/sdl2_mixer
[INFO]:    -> running basename https://www.libsdl.or...(and 52 more)
[INFO]:    sdl2_mixer download already cached, skipping                        
[INFO]:    <- directory context /home/rufus
[INFO]:    Downloading sdl2_ttf
[INFO]:    -> running mkdir -p /home/rufus/.local/sh...(and 40 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/packages/sdl2_ttf
[INFO]:    -> running basename https://www.libsdl.org...(and 48 more)
[INFO]:    sdl2_ttf download already cached, skipping                          
[INFO]:    <- directory context /home/rufus
[INFO]:    Downloading python2
[INFO]:    -> running mkdir -p /home/rufus/.local/sh...(and 39 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/packages/python2
[INFO]:    -> running basename https://python.org/ftp...(and 34 more)
[INFO]:    python2 download already cached, skipping                           
[INFO]:    <- directory context /home/rufus
[INFO]:    Downloading sdl2
[INFO]:    -> running mkdir -p /home/rufus/.local/sh...(and 36 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/packages/sdl2
[INFO]:    -> running basename https://www.libsdl.org...(and 26 more)
[INFO]:    sdl2 download already cached, skipping                              
[INFO]:    <- directory context /home/rufus
[INFO]:    Downloading six
[INFO]:    -> running mkdir -p /home/rufus/.local/sh...(and 35 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/packages/six
[INFO]:    -> running basename https://pypi.python.or...(and 40 more)
[INFO]:    six download already cached, skipping                               
[INFO]:    <- directory context /home/rufus
[INFO]:    Downloading pyjnius
[INFO]:    -> running mkdir -p /home/rufus/.local/sh...(and 39 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/packages/pyjnius
[INFO]:    -> running basename https://github.com/kiv...(and 28 more)
[INFO]:    pyjnius download already cached, skipping                           
[INFO]:    <- directory context /home/rufus
[INFO]:    Downloading kivy
[INFO]:    -> running mkdir -p /home/rufus/.local/sh...(and 36 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/packages/kivy
[INFO]:    -> running basename https://github.com/kiv...(and 25 more)
[INFO]:    kivy download already cached, skipping                              
[INFO]:    <- directory context /home/rufus
[INFO]:    # Building all recipes for arch armeabi-v7a
[INFO]:    # Unpacking recipes
[INFO]:    Unpacking hostpython2 for armeabi-v7a
[INFO]:    -> running basename https://python.org/ftp...(and 34 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/other_builds/hostpython2/desktop
[INFO]:    hostpython2 is already unpacked, skipping
[INFO]:    <- directory context /home/rufus
[INFO]:    Unpacking sdl2_image for armeabi-v7a
[INFO]:    -> running basename https://www.libsdl.or...(and 52 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni
[INFO]:    sdl2_image is already unpacked, skipping
[INFO]:    <- directory context /home/rufus
[INFO]:    Unpacking sdl2_mixer for armeabi-v7a
[INFO]:    -> running basename https://www.libsdl.or...(and 52 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni
[INFO]:    sdl2_mixer is already unpacked, skipping
[INFO]:    <- directory context /home/rufus
[INFO]:    Unpacking sdl2_ttf for armeabi-v7a
[INFO]:    -> running basename https://www.libsdl.org...(and 48 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni
[INFO]:    sdl2_ttf is already unpacked, skipping
[INFO]:    <- directory context /home/rufus
[INFO]:    Unpacking python2 for armeabi-v7a
[INFO]:    -> running basename https://python.org/ftp...(and 34 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/other_builds/python2/armeabi-v7a
[INFO]:    python2 is already unpacked, skipping
[INFO]:    <- directory context /home/rufus
[INFO]:    Unpacking sdl2 for armeabi-v7a
[INFO]:    -> running basename https://www.libsdl.org...(and 26 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni
[INFO]:    sdl2 is already unpacked, skipping
[INFO]:    <- directory context /home/rufus
[INFO]:    Unpacking six for armeabi-v7a
[INFO]:    -> running basename https://pypi.python.or...(and 40 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/other_builds/six-python2/armeabi-v7a
[INFO]:    six is already unpacked, skipping
[INFO]:    <- directory context /home/rufus
[INFO]:    Unpacking pyjnius for armeabi-v7a
[INFO]:    -> running basename https://github.com/kiv...(and 28 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/other_builds/pyjnius-python2-sdl2/armeabi-v7a
[INFO]:    pyjnius is already unpacked, skipping
[INFO]:    <- directory context /home/rufus
[INFO]:    Unpacking kivy for armeabi-v7a
[INFO]:    -> running basename https://github.com/kiv...(and 25 more)
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/other_builds/kivy-python2-sdl2/armeabi-v7a
[INFO]:    kivy is already unpacked, skipping
[INFO]:    <- directory context /home/rufus
[INFO]:    # Prebuilding recipes
[INFO]:    Prebuilding hostpython2 for armeabi-v7a
[INFO]:    -> running cp /home/rufus/kivyinstall/li...(and 178 more)
[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 python2 for armeabi-v7a
[INFO]:    python2 has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for python2[armeabi-v7a]
[INFO]:    python2 already patched, 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 hostpython2 for armeabi-v7a
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/other_builds/hostpython2/desktop/hostpython2
[INFO]:    hostpython already exists, skipping build
[INFO]:    <- directory context /home/rufus
[INFO]:    Building sdl2_image for armeabi-v7a
[INFO]:    Building sdl2_mixer for armeabi-v7a
[INFO]:    Building sdl2_ttf for armeabi-v7a
[INFO]:    Building python2 for armeabi-v7a
[INFO]:    -> running cp -a /home/rufus/.local/shar...(and 164 more)
[INFO]:    Copying hostpython binary to targetpython folder
[INFO]:    -> running cp /home/rufus/.local/share/p...(and 177 more)
[INFO]:    -> running cp /home/rufus/.local/share/p...(and 175 more)
[INFO]:    Building sdl2 for armeabi-v7a
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni
[INFO]:    -> running ndk-build V=1
[INFO]:    <- directory context /home/rufus                                   
[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/rufus/.local/share/python-for-android/build/other_builds/six-python2/armeabi-v7a/six
[INFO]:    -> running python.host setup.py install -O2
[INFO]:    <- directory context /home/rufus                                   
[INFO]:    Building pyjnius for armeabi-v7a
[INFO]:    jnius apparently isn't already in site-packages
[INFO]:    Cythonizing anything necessary in pyjnius
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/other_builds/pyjnius-python2-sdl2/armeabi-v7a/pyjnius
[INFO]:    -> running python.host -c import sys; print(sys.path)
cwd is /home/rufus/.local/share/python-for-android/build/other_builds/pyjnius-python2-sdl2/armeabi-v7a/pyjnius
[INFO]:    Trying first build of pyjnius to get cython files: this is expected to fail
[INFO]:    -> running python.host setup.py build_ext -v
[INFO]:    First build appeared to complete correctly, skipping manualcythonising.
[INFO]:    Stripping object files
[INFO]:    -> running find ./build/lib.linux-x86_64-...(and 69 more)
[INFO]:    <- directory context /home/rufus
[INFO]:    Installing pyjnius into site-packages
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/other_builds/pyjnius-python2-sdl2/armeabi-v7a/pyjnius
[INFO]:    -> running python.host setup.py install -O2
[INFO]:    <- directory context /home/rufus                                   
[INFO]:    Building kivy for armeabi-v7a
[INFO]:    kivy apparently isn't already in site-packages
[INFO]:    Cythonizing anything necessary in kivy
[INFO]:    -> directory context /home/rufus/.local/share/python-for-android/build/other_builds/kivy-python2-sdl2/armeabi-v7a/kivy
[INFO]:    -> running python.host -c import sys; print(sys.path)
cwd is /home/rufus/.local/share/python-for-android/build/other_builds/kivy-python2-sdl2/armeabi-v7a/kivy
[INFO]:    Trying first build of kivy to get cython files: this is expected to fail
[INFO]:    -> running python.host setup.py build_ext -v
           working:  error: command 'arm-linux-androideabi-gcc...(and 27 more) Exception in thread background thread for pid 4366:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/rufus/.local/share/python-for-android/build/python-installs/unnamed_dist_7/bin/python.host setup.py build_ext -v

  STDOUT:
Using distutils
Environ change use_sdl2 -> True

Cython check avoided.
Using this graphics system: OpenGL ES 2
SDL2 found via pkg-config
SDL2: found SDL header at /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL/include/SDL.h
SDL2: found SDL_mixer header at /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_mixer/SDL_mixer.h
SDL2: found SDL_ttf header at /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_ttf/SDL_ttf.h
SDL2: found SDL_image header at /home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_image/SDL_image.h
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
 /home/rufus/.local/share/python-for-android/build/python-installs/unnamed_dist_7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'setup_requires'
   warnings.warn(msg)
 /home/rufus/.local/share/python-for-android/build/python-installs/unnamed_dist_7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'dependency_links'
   warnings.warn(msg)
 /home/rufus/.local/share/python-for-android/build/python-installs/unnamed_dist_7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
   warnings.warn(msg)
running build_ext
Build configuration is:
 * use_rpi = 0
 * use_mali = 0
 * use_egl = 0
 * use_opengl_es2 = 1
 * use_opengl_mock = 0
 * use_sdl2 = 1
 * use_ios = 0
 * use_mesagl = 0
 * use_x11 = 0
 * use_gstreamer = 0
 * use_avfoundation = 0
 * use_osx_frameworks = 0
 * debug_gl = 0
 * debug = False
Detected compiler is unix
building 'kivy.core.text._text_sdl2' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -isystem /home/rufus/Android/Ndk/sysroot/usr/include/arm-linux-androideabi -isysroot /home/rufus/Android/Ndk/sysroot -I/home/rufus/.local/share/python-for-android/build/python-installs/unnamed_dist_7/include/python2.7 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer -D__ANDROID_API__=19 -isystem /home/rufus/Android/Ndk/sysroot/usr/include/arm-linux-androideabi -isysroot /home/rufus/Android/Ndk/sysroot -I/home/rufus/.local/share/python-for-android/build/python-installs/unnamed_dist_7/include/python2.7 -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -Ikivy/include -I/home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL/include -I/home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_image -I/home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_mixer -I/home/rufus/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle-python2/jni/SDL2_ttf -I/usr/include/SDL2 -I/home/rufus/.local/share/python-for-android/build/python-installs/unnamed_dist_7/include/python2.7 -c kivy/core/text/_text_sdl2.c -o build/temp.linux-x86_64-2.7/kivy/core/text/_text_sdl2.o
arm-linux-androideabi-gcc: error: kivy/core/text/_text_sdl2.c: No such file or directory
arm-linux-androideabi-gcc: fatal error: no input files
compilation terminated.
 error: command 'arm-linux-androideabi-gcc' failed with exit status 1


  STDERR:



[INFO]:    kivy first build failed (as expected)
[INFO]:    Running cython where appropriate
[INFO]:    Cythonize kivy/properties.pyx
[INFO]:    -> running cython ./kivy/properties.pyx
[INFO]:    Cythonize kivy/_clock.pyx
[INFO]:    -> running cython ./kivy/_clock.pyx
[INFO]:    Cythonize kivy/weakproxy.pyx
[INFO]:    -> running cython ./kivy/weakproxy.pyx
[INFO]:    Cythonize kivy/_event.pyx
[INFO]:    -> running cython ./kivy/_event.pyx
[INFO]:    Cythonize kivy/lib/vidcore_lite/egl.pyx
[INFO]:    -> running cython ./kivy/lib/vidcore_lite/egl.pyx
           working: kivy/lib/vidcore_lite/egl.pyx:619:17: cimp...(and 51 more) Exception in thread background thread for pid 4414:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/rufus/kivyinstall/bin/cython ./kivy/lib/vidcore_lite/egl.pyx

  STDOUT:

Error compiling Cython file:
------------------------------------------------------------
...
    cdef:
        bcm.DISPMANX_DISPLAY_HANDLE_T disp
        bcm.DisplayHandle D
    disp = bcm.vc_dispmanx_display_open( device )
    if disp == 0:
        raise bcm.BCMDisplayException("Couldn't open handle to display")
                ^
------------------------------------------------------------

kivy/lib/vidcore_lite/egl.pyx:608:17: cimported module has no attribute 'BCMDisplayException'

Error compiling Cython file:
------------------------------------------------------------
...
    cdef:
        bcm.DISPMANX_UPDATE_HANDLE_T hdl
        bcm.UpdateHandle U
    hdl = bcm.vc_dispmanx_update_start( priority )
    if hdl == 0:
        raise bcm.BCMDisplayException("Couldn't open handle to update-start")
                ^
------------------------------------------------------------

kivy/lib/vidcore_lite/egl.pyx:619:17: cimported module has no attribute 'BCMDisplayException'


  STDERR:


Traceback (most recent call last):                                             
  File "/home/rufus/kivyinstall/bin/p4a", line 11, in <module>
    sys.exit(main())
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/build.py", line 573, in build_recipes
    recipe.build_arch(arch)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/recipe.py", line 928, in build_arch
    self.build_cython_components(arch)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/recipe.py", line 963, in build_cython_components
    self.cythonize_build(env=env)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/recipes/kivy/__init__.py", line 18, in cythonize_build
    super(KivyRecipe, self).cythonize_build(env, build_dir=build_dir)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/recipe.py", line 1008, in cythonize_build
    self.cythonize_file(env, build_dir, join(root, filename))
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/recipe.py", line 999, in cythonize_file
    shprint(cython_command, filename, *self.cython_args, _env=cyenv)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/pythonforandroid/logger.py", line 175, in shprint
    for line in output:
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/sh.py", line 720, in next
    self.wait()
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/sh.py", line 651, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/rufus/kivyinstall/lib/python3.6/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/rufus/kivyinstall/bin/cython ./kivy/lib/vidcore_lite/egl.pyx

  STDOUT:

Error compiling Cython file:
------------------------------------------------------------
...
    cdef:
        bcm.DISPMANX_DISPLAY_HANDLE_T disp
        bcm.DisplayHandle D
    disp = bcm.vc_dispmanx_display_open( device )
    if disp == 0:
        raise bcm.BCMDisplayException("Couldn't open handle to display")
                ^
------------------------------------------------------------

kivy/lib/vidcore_lite/egl.pyx:608:17: cimported module has no attribute 'BCMDisplayException'

Error compiling Cython file:
------------------------------------------------------------
...
    cdef:
        bcm.DISPMANX_UPDATE_HANDLE_T hdl
        bcm.UpdateHandle U
    hdl = bcm.vc_dispmanx_update_start( priority )
    if hdl == 0:
        raise bcm.BCMDisplayException("Couldn't open handle to update-start")
                ^
------------------------------------------------------------

kivy/lib/vidcore_lite/egl.pyx:619:17: cimported module has no attribute 'BCMDisplayException'


  STDERR:

最佳答案

降级您的 Cython。以下是与 Kivy 兼容的 Cython 列表。

sudo pip install --upgrade cython==x.yy.z

Working versions

Kivy 1.11.0.dev0 -> Cython==0.28.3
Kivy 1.10.1 -> Cython==0.28.2
Kivy 1.10.0 -> Cython==0.25.2
Kivy 1.9.1 -> Cython==0.23.1
Kivy 1.9.0 -> Cython==0.21.2

关于android - 尝试使用 p4a 编译 "Hello World"Kivy 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51581248/

相关文章:

python - 如何将 OpenCV 与 PyQt 结合起来创建一个简单的 GUI?

python - Kivy按钮位置和标签背景色

python - 同时运行多个相互通信的 Kivy 应用程序

java - 如何在android volley中隐藏Url或参数值?

java - 按照 Google App Engine 教程创建 Web 应用程序项目

android - 配置特定的 gradle flavor 组合

android - Android 中每个用户的唯一 ID

python - 如何从 "python setup.py test"运行 unittest discover ?

Python SSL错误解密失败或坏记录mac

python - 如何删除 kivy 中的小部件?