首页 > 编程问答 >使用 kivy 从 python 脚本的 buildozer 构建 android apk 时出错

使用 kivy 从 python 脚本的 buildozer 构建 android apk 时出错

时间:2024-07-30 05:34:23浏览次数:7  
标签:python android kivy buildozer

我想从使用 kivy 包构建的Python脚本构建 apk 为此,我使用 google collab .

这里是 main.py 脚本:

import youtube_dl
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput


class DownloadLayout(BoxLayout):
    def __init__(self, **kwargs):
    super().__init__(**kwargs)

    # Create a text input field
    self.text_input = TextInput(hint_text="Paste YouTube link here")
    self.add_widget(self.text_input)

    # Create a download button
    self.download_button = Button(text="Download")
    self.download_button.bind(on_release=self.download_video)
    self.add_widget(self.download_button)

def download_video(self, *args):
    # Get the YouTube link from the text input field
    youtube_link = self.text_input.text

    # Download the video using youtube-dl
    ydl_opts = {}
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download([youtube_link])


class DownloadApp(App):
    def build(self):
        return DownloadLayout()


if __name__ == '__main__':
    DownloadApp().run()

这里是 buildozer.spec|| |文件: 这是

[app]

# (str) Title of your application
title = My Application

# (str) Package name
package.name = myapp

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas

# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png

# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec

# (list) List of directory to exclude (let empty to not exclude anything)
#source.exclude_dirs = tests, bin, venv

# (list) List of exclusions using pattern matching
# Do not prefix with './'
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
version = 0.1

# (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"]
# version.filename = %(source.dir)s/main.py

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy, kivymd, pillow



# change the major version of python used by the app
osx.python_version = 3

# Kivy version to use
osx.kivy_version = 1.9.1
    

错误日志 运行 命令时: buildozer android debug 我尝试调整cpython或kivy的版本。但它似乎并没有解决这个问题。

[DEBUG]:    clang-14: error: no such file or directory: 'jnius/jnius.c'
[DEBUG]:    clang-14: error: no input files
[DEBUG]:    error: command '/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang' failed with exit code 1
Exception in thread background thread for pid 52253:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/root/.local/lib/python3.10/site-packages/sh.py", line 1641, in wrap
    fn(*rgs, **kwargs)
  File "/root/.local/lib/python3.10/site-packages/sh.py", line 2569, in background_thread
    handle_exit_code(exit_code)
  File "/root/.local/lib/python3.10/site-packages/sh.py", line 2269, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/root/.local/lib/python3.10/site-packages/sh.py", line 869, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py build_ext -v

  STDERR:

[INFO]:    pyjnius first build failed (as expected)
[INFO]:    Running cython where appropriate
[INFO]:    Cythonize jnius/jnius.pyx
[DEBUG]:   -> running python3 -cimport sys; from Cython.Compiler.Main import setuptools_main; sys.exit(setuptools_main()); ./jnius/jnius.pyx
[DEBUG]:    /usr/local/lib/python3.10/dist-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/pyjnius-sdl2/armeabi-v7a__ndk_target_21/pyjnius/jnius/jnius.pyx
[DEBUG]:      tree = Parsing.p_module(s, pxd, full_module_name)
[DEBUG]:   -> running python3 setup.py build_ext -v
[DEBUG]:    warning: [options] bootstrap class path not set in conjunction with -source 7
[DEBUG]:    1 warning
[DEBUG]:    running build_ext
[DEBUG]:    building 'jnius' extension
[DEBUG]:    /root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -I/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include -DANDROID -I/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -I/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/armeabi-v7a/include/python3.1 -fPIC -I/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/Include -I/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build -c jnius/jnius.c -o build/temp.linux-x86_64-3.10/jnius/jnius.o
[DEBUG]:    jnius/jnius.c:12406:19: warning: assigning to 'jchar *' (aka 'unsigned short *') from 'const jchar *' (aka 'const unsigned short *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
[DEBUG]:      __pyx_v_j_chars = (__pyx_v_j_env[0])->GetStringChars(__pyx_v_j_env, __pyx_v_j_string, NULL);
[DEBUG]:                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:54433:5: error: expression is not assignable
[DEBUG]:        ++Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:54435:5: error: expression is not assignable
[DEBUG]:        --Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:54549:5: error: expression is not assignable
[DEBUG]:        ++Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:54551:5: error: expression is not assignable
[DEBUG]:        --Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:54803:5: error: expression is not assignable
[DEBUG]:        ++Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:54805:5: error: expression is not assignable
[DEBUG]:        --Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:55697:5: error: expression is not assignable
[DEBUG]:        ++Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:55699:5: error: expression is not assignable
[DEBUG]:        --Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:56008:5: error: expression is not assignable
[DEBUG]:        ++Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:56010:5: error: expression is not assignable
[DEBUG]:        --Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:56258:5: error: expression is not assignable
[DEBUG]:        ++Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:56260:5: error: expression is not assignable
[DEBUG]:        --Py_REFCNT(o);
[DEBUG]:        ^ ~~~~~~~~~~~~
[DEBUG]:    jnius/jnius.c:59573:16: warning: 'PyUnicode_FromUnicode' is deprecated [-Wdeprecated-declarations]
[DEBUG]:            return PyUnicode_FromUnicode(NULL, 0);
[DEBUG]:                   ^
[DEBUG]:    /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/cpython/unicodeobject.h:551:1: note: 'PyUnicode_FromUnicode' has been explicitly marked deprecated here
[DEBUG]:    Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
[DEBUG]:    ^
[DEBUG]:    /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
[DEBUG]:    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
[DEBUG]:                                                         ^
[DEBUG]:    jnius/jnius.c:60809:16: warning: 'PyUnicode_FromUnicode' is deprecated [-Wdeprecated-declarations]
[DEBUG]:            return PyUnicode_FromUnicode(NULL, 0);
[DEBUG]:                   ^
[DEBUG]:    /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/cpython/unicodeobject.h:551:1: note: 'PyUnicode_FromUnicode' has been explicitly marked deprecated here
[DEBUG]:    Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
[DEBUG]:    ^
[DEBUG]:    /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
[DEBUG]:    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
[DEBUG]:                                                         ^
[DEBUG]:    3 warnings and 12 errors generated.
[DEBUG]:    error: command '/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang' failed with exit code 1
Exception in thread background thread for pid 52311:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/root/.local/lib/python3.10/site-packages/sh.py", line 1641, in wrap
    fn(*rgs, **kwargs)
  File "/root/.local/lib/python3.10/site-packages/sh.py", line 2569, in background_thread
    handle_exit_code(exit_code)
  File "/root/.local/lib/python3.10/site-packages/sh.py", line 2269, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/root/.local/lib/python3.10/site-packages/sh.py", line 869, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py build_ext -v

  STDOUT:
warning: [options] bootstrap class path not set in conjunction with -source 7
1 warning
running build_ext
building 'jnius' extension
jnius/jnius.c:12406:19: warning: assigning to 'jchar *' (aka 'unsigned short *') from 'const jchar *' (aka 'const unsigned short *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
  __pyx_v_j_chars = (__pyx_v_j_env[0])->GetStringChars(__pyx_v_j_env, __pyx_v_j_string, NULL);
                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jnius/jnius.c:56258:5: error: expression is not assignable
    ++Py_REFCNT(o);
    ^ ~~~~~~~~~~~~
jnius/jnius.c:56260:5: error: expression is not assignable
    --Py_REFCNT(o);
    ^ ~~~~~~~~~~~~
jnius/jnius.c:59573:16: warning: 'PyUnicode_FromUnicode' is deprecated [-Wdeprecated-declarations]
        return PyUnicode_FromUnicode(NULL, 0);
               ^
/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/cpython/unicodeobject.h:551:1: note: 'PyUnicode_FromUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^
/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
jnius/jnius.c:60809:16: warning: 'PyUnicode_FromUnicode' is deprecated [-Wdeprecated-declarations]
        return PyUnicode_FromUnicode(NULL, 0);
               ^
/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/cpython/unicodeobject.h:551:1: note: 'PyUnicode_FromUnicode' has been explicitly marked deprecated here
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
^
/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^
3 warnings and 12 errors generated.
error: command '/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang' failed with exit code 1


  STDERR:

[INFO]:    STDOUT (last 20 lines of 64):
    jnius/jnius.c:59573:16: warning: 'PyUnicode_FromUnicode' is deprecated [-Wdeprecated-declarations]  
        return PyUnicode_FromUnicode(NULL, 0);  
               ^    
/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/cpython/unicodeobject.h:551:1: note: 'PyUnicode_FromUnicode' has been explicitly marked deprecated here  
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( 
^   
/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'   
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))   
                                                     ^  
jnius/jnius.c:60809:16: warning: 'PyUnicode_FromUnicode' is deprecated [-Wdeprecated-declarations]  
        return PyUnicode_FromUnicode(NULL, 0);  
               ^    
/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/cpython/unicodeobject.h:551:1: note: 'PyUnicode_FromUnicode' has been explicitly marked deprecated here  
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( 
^   
/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include/pyport.h:513:54: note: expanded from macro 'Py_DEPRECATED'   
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))   
                                                     ^  
3 warnings and 12 errors generated. 
error: command '/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang' failed with exit code 1
[INFO]:    STDERR:
    
[INFO]:    ENV:
export HOME='/root'
export CFLAGS='-target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -I/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include'
export CXXFLAGS='-target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC'
export CPPFLAGS='-DANDROID -I/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -I/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/armeabi-v7a/include/python3.1'
export LDFLAGS='  -L/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/libs_collections/myapp/armeabi-v7a -L/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/android-build -lpython3.10 -L/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/libs_collections/myapp/armeabi-v7a -L/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/libs_collections/myapp  -L/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/obj/local/armeabi-v7a '
export LDLIBS='-lm'
export PATH='/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin:/root/.buildozer/android/platform/android-ndk-r25b:/root/.buildozer/android/platform/android-sdk/tools:/root/.buildozer/android/platform/apache-ant-1.9.4/bin:/opt/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tools/node/bin:/tools/google-cloud-sdk/bin'
export CC='/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC'
export CXX='/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC'
export AR='/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar'
export RANLIB='/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib'
export STRIP='/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --strip-unneeded'
export READELF='/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readelf'
export OBJCOPY='/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-objcopy'
export MAKE='make -j2'
export ARCH='armeabi-v7a'
export NDK_API='android-21'
export LDSHARED='/root/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -shared'
export BUILDLIB_PATH='/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/build/lib.linux-x86_64-3.10'
export PYTHONNOUSERSITE='1'
export LANG='en_GB.UTF-8'
export PYTHONPATH='/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib:/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/Lib/site-packages:/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/build/lib.linux-x86_64-3.10:/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/build/temp.linux-x86_64-3.10:/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/build/scripts-3.10'
export LIBLINK='NOTNONE'
export COPYLIBS='1'
export LIBLINK_PATH='/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/pyjnius-sdl2/armeabi-v7a__ndk_target_21/objects_pyjnius'
export NDKPLATFORM='NOTNONE'

[INFO]:    COMMAND:
cd /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/pyjnius-sdl2/armeabi-v7a__ndk_target_21/pyjnius && /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py build_ext -v

[WARNING]: ERROR: /content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 failed!

# Command failed: ['/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=myapp', '--bootstrap=sdl2', '--requirements=python3,kivy,kivymd,pillow', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug']
# ENVIRONMENT:
#     SHELL = '/bin/bash'
#     NV_LIBCUBLAS_VERSION = '11.11.3.6-1'
#     NVIDIA_VISIBLE_DEVICES = 'all'
#     COLAB_JUPYTER_TRANSPORT = 'ipc'
#     NV_NVML_DEV_VERSION = '11.8.86-1'
#     NV_CUDNN_PACKAGE_NAME = 'libcudnn8'
#     CGROUP_MEMORY_EVENTS = '/sys/fs/cgroup/memory.events /var/colab/cgroup/jupyter-children/memory.events'
#     NV_LIBNCCL_DEV_PACKAGE = 'libnccl-dev=2.16.2-1+cuda11.8'
#     NV_LIBNCCL_DEV_PACKAGE_VERSION = '2.16.2-1'
#     VM_GCE_METADATA_HOST = '169.254.169.253'
#     HOSTNAME = 'dae94e6f0ee1'
#     TBE_RUNTIME_ADDR = '172.28.0.1:8011'
#     GCE_METADATA_TIMEOUT = '3'
#     NVIDIA_REQUIRE_CUDA = ('cuda>=11.8 brand=tesla,driver>=450,driver<451 '
 'brand=tesla,driver>=470,driver<471 brand=unknown,driver>=470,driver<471 '
 'brand=nvidia,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 '
 'brand=geforce,driver>=470,driver<471 brand=geforcertx,driver>=470,driver<471 '
 'brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 '
 'brand=titan,driver>=470,driver<471 brand=titanrtx,driver>=470,driver<471 '
 'brand=tesla,driver>=510,driver<511 brand=unknown,driver>=510,driver<511 '
 'brand=nvidia,driver>=510,driver<511 brand=nvidiartx,driver>=510,driver<511 '
 'brand=geforce,driver>=510,driver<511 brand=geforcertx,driver>=510,driver<511 '
 'brand=quadro,driver>=510,driver<511 brand=quadrortx,driver>=510,driver<511 '
 'brand=titan,driver>=510,driver<511 brand=titanrtx,driver>=510,driver<511 '
 'brand=tesla,driver>=515,driver<516 brand=unknown,driver>=515,driver<516 '
 'brand=nvidia,driver>=515,driver<516 brand=nvidiartx,driver>=515,driver<516 '
 'brand=geforce,driver>=515,driver<516 brand=geforcertx,driver>=515,driver<516 '
 'brand=quadro,driver>=515,driver<516 brand=quadrortx,driver>=515,driver<516 '
 'brand=titan,driver>=515,driver<516 brand=titanrtx,driver>=515,driver<516')
#     NV_LIBCUBLAS_DEV_PACKAGE = 'libcublas-dev-11-8=11.11.3.6-1'
#     NV_NVTX_VERSION = '11.8.86-1'
#     COLAB_JUPYTER_IP = '172.28.0.12'
#     NV_CUDA_CUDART_DEV_VERSION = '11.8.89-1'
#     NV_LIBCUSPARSE_VERSION = '11.7.5.86-1'
#     COLAB_LANGUAGE_SERVER_PROXY_ROOT_URL = 'http://172.28.0.1:8013/'
#     NV_LIBNPP_VERSION = '11.8.0.86-1'
#     NCCL_VERSION = '2.16.2-1'
#     KMP_LISTEN_PORT = '6000'
#     TF_FORCE_GPU_ALLOW_GROWTH = 'true'
#     ENV = '/root/.bashrc'
#     PWD = '/content'
#     COLAB_LANGUAGE_SERVER_PROXY_REQUEST_TIMEOUT = '30s'
#     TBE_EPHEM_CREDS_ADDR = '172.28.0.1:8009'
#     TBE_CREDS_ADDR = '172.28.0.1:8008'
#     NV_CUDNN_PACKAGE = 'libcudnn8=8.7.0.84-1+cuda11.8'
#     NVIDIA_DRIVER_CAPABILITIES = 'compute,utility'
#     COLAB_JUPYTER_TOKEN = ''
#     LAST_FORCED_REBUILD = '20230523'
#     NV_NVPROF_DEV_PACKAGE = 'cuda-nvprof-11-8=11.8.87-1'
#     NV_LIBNPP_PACKAGE = 'libnpp-11-8=11.8.0.86-1'
#     NV_LIBNCCL_DEV_PACKAGE_NAME = 'libnccl-dev'
#     TCLLIBPATH = '/usr/share/tcltk/tcllib1.20'
#     NV_LIBCUBLAS_DEV_VERSION = '11.11.3.6-1'
#     COLAB_KERNEL_MANAGER_PROXY_HOST = '172.28.0.12'
#     NVIDIA_PRODUCT_NAME = 'CUDA'
#     NV_LIBCUBLAS_DEV_PACKAGE_NAME = 'libcublas-dev-11-8'
#     USE_AUTH_EPHEM = '1'
#     NV_CUDA_CUDART_VERSION = '11.8.89-1'
#     HOME = '/root'
#     LANG = 'en_US.UTF-8'
#     CUDA_VERSION = '11.8.0'
#     CLOUDSDK_CONFIG = '/content/.config'
#     NV_LIBCUBLAS_PACKAGE = 'libcublas-11-8=11.11.3.6-1'
#     COLAB_RELEASE_TAG = 'release-colab-20230525-060141-RC00'
#     PYDEVD_USE_FRAME_EVAL = 'NO'
#     KMP_TARGET_PORT = '9000'
#     CLICOLOR = '1'
#     KMP_EXTRA_ARGS = ('--logtostderr --listen_host=172.28.0.12 --target_host=172.28.0.12 '
 '--tunnel_background_save_url=https://colab.research.google.com/tun/m/cc48301118ce562b961b3c22d803539adc1e0c19/m-s-2awkvtwksyzv0 '
 '--tunnel_background_save_delay=10s '
 '--tunnel_periodic_background_save_frequency=30m0s '
 '--enable_output_coalescing=true --output_coalescing_required=true')
#     NV_LIBNPP_DEV_PACKAGE = 'libnpp-dev-11-8=11.8.0.86-1'
#     NV_LIBCUBLAS_PACKAGE_NAME = 'libcublas-11-8'
#     COLAB_KERNEL_MANAGER_PROXY_PORT = '6000'
#     CLOUDSDK_PYTHON = 'python3'
#     NV_LIBNPP_DEV_VERSION = '11.8.0.86-1'
#     ENABLE_DIRECTORYPREFETCHER = '1'
#     NO_GCE_CHECK = 'False'
#     JPY_PARENT_PID = '82'
#     PYTHONPATH = '/env/python'
#     TERM = 'xterm-color'
#     NV_LIBCUSPARSE_DEV_VERSION = '11.7.5.86-1'
#     GIT_PAGER = 'cat'
#     LIBRARY_PATH = '/usr/local/cuda/lib64/stubs'
#     NV_CUDNN_VERSION = '8.7.0.84'
#     SHLVL = '0'
#     PAGER = 'cat'
#     COLAB_LANGUAGE_SERVER_PROXY = '/usr/colab/bin/language_service'
#     NV_CUDA_LIB_VERSION = '11.8.0-1'
#     NVARCH = 'x86_64'
#     NV_CUDNN_PACKAGE_DEV = 'libcudnn8-dev=8.7.0.84-1+cuda11.8'
#     NV_CUDA_COMPAT_PACKAGE = 'cuda-compat-11-8'
#     MPLBACKEND = 'module://ipykernel.pylab.backend_inline'
#     NV_LIBNCCL_PACKAGE = 'libnccl2=2.16.2-1+cuda11.8'
#     LD_LIBRARY_PATH = '/usr/local/nvidia/lib:/usr/local/nvidia/lib64'
#     COLAB_GPU = ''
#     GCS_READ_CACHE_BLOCK_SIZE_MB = '16'
#     NV_NVPROF_VERSION = '11.8.87-1'
#     COLAB_FILE_HANDLER_ADDR = 'localhost:3453'
#     PATH = '/root/.buildozer/android/platform/apache-ant-1.9.4/bin:/opt/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tools/node/bin:/tools/google-cloud-sdk/bin'
#     NV_LIBNCCL_PACKAGE_NAME = 'libnccl2'
#     COLAB_DEBUG_ADAPTER_MUX_PATH = '/usr/local/bin/dap_multiplexer'
#     NV_LIBNCCL_PACKAGE_VERSION = '2.16.2-1'
#     PYTHONWARNINGS = 'ignore:::pip._internal.cli.base_command'
#     DEBIAN_FRONTEND = 'noninteractive'
#     COLAB_BACKEND_VERSION = 'next'
#     OLDPWD = '/'
#     _ = '/usr/local/bin/buildozer'
#     PACKAGES_PATH = '/root/.buildozer/android/packages'
#     ANDROIDSDK = '/root/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/root/.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

I have tried tweaking the versions of cpython or kivy. But it doesn't seem to be fixing this issue.


该错误与 Pyjnius 相关,Pyjnius 是一个用于从 Python 代码访问 Java 代码的 Kivy 依赖项。具体来说,错误信息“clang-14: error: no such file or directory: 'jnius/jnius.c'”表明在编译过程中找不到 jnius.c 文件。

这可能是由以下几种原因导致的:

  1. Pyjnius 安装问题: 确保已正确安装 Pyjnius,并且安装没有损坏。可以尝试重新安装 Pyjnius: bash pip install --upgrade --force-reinstall cython pip install --upgrade --force-reinstall pyjnius

  2. Buildozer 缓存问题: Buildozer 有时会缓存旧文件,这可能会导致问题。尝试清除 Buildozer 缓存并重新构建项目: bash buildozer android clean buildozer android debug

  3. NDK 版本不兼容: 正在使用的 NDK 版本可能与的 Python 和 Kivy 版本不兼容。尝试使用较旧的 NDK 版本,例如 r21:

    • buildozer.spec 文件中,将 android.ndk_version 设置为所需版本: android.ndk_version = r21
    • 重新运行 buildozer android debug
  4. Google Colab 环境问题: Google Colab 的环境可能存在一些问题。尝试在本地计算机上构建的 APK,看看是否可以解决问题。

其他建议:

  • buildozer.spec 文件中设置 log_level = 2 ,以便在构建过程中获取更详细的日志信息。
  • 确保的 buildozer.spec 文件中的所有依赖项都已正确列出,并且版本兼容。
  • 检查 jnius 文件夹是否存在于的项目目录中,并且包含 jnius.c 文件。

如果问题仍然存在,请提供以下信息,以便我更好地帮助:

  • 的 Buildozer、Python、Cython、Pyjnius 和 NDK 版本。
  • 正在使用的操作系统。
  • 完整的 Buildozer 日志文件(使用 log_level = 2 生成)。

标签:python,android,kivy,buildozer
From: 76356642

相关文章

  • 自动解码并检索 S/MIME 加密电子邮件的正文 (python)
    我如何:用python代码连接我的邮件收件箱以自动获取未读电子邮件的加密内容;解码S/MIME加密电子邮件(我有密钥);检索电子邮件正文纯文本;检查正文(或主题)是否与某个关键字(现在为“test”)匹配,并在匹配时打印一些内容;在树莓派上使用此代码,无需手动......
  • Python 3 写入 DBF(带有 Memo 的 dBase IV)
    我需要在Python3中写入带有备注字段的dBaseIVdbf文件,但找不到合适的模块来执行此操作。我尝试过的包:Simpledbf-只读dbf-不支持dBaseIVdbfpy-不支持Python3dbfpy3-不支持dBaseIVYDbf-不支持备注字段pyshp-无法仅使用dbf文件......
  • Robin-Stocks Python 中的 order_buy_fractional_by_price 问题
    我在Robin-StocksPython包中的order_buy_fractional_by_price函数中遇到问题。在正常市场交易时间内下达以美元为基础的买入订单时,该订单被错误地设置为限价订单。对我来说看起来有问题的代码似乎是导致此问题的原因。我尝试在包管理器中本地修改或删除有问题的代码,但遇......
  • 在python中使用turtle绘制图案(带点)
    我正在尝试使用python中的海龟制作一幅赫斯特画(点图案)。我设法实现了它。Hirst_painting_dot_pattern但是我的for循环没有按照我预期的方式工作。它省略了最后一次迭代。在下面的代码中,我的for循环没有生成最后一个点。因此,我在循环末尾添加了一行来制作最后......
  • 使用 Python 进行 QuantLib Vanilla 掉期定价 - 错误
    我真的需要帮助...我有一个使用QuantLib构建自己的VanillaSwapPricer的项目。我想根据ois掉期的市场价格进行计算以进行贴现,并根据Euribor6M掉期+FRA进行预测固定。总而言之,我的目标是尽可能接近彭博社对标准Euribor6M掉期的定价(贴现ois)-fwdEuribor6M)。......
  • 我正在制作一个可以打开wav文件的python程序,我想知道wav文件的格式是什么
    因此,我已经通过此网站的研究编写了验证并读取wav标头的代码。但我想知道,data段中的数据是如何存储的?它们位于16位部分中,彼此相邻放置。我认为在Audacity中制作440hz正弦波,然后导出它,会显示一些结果,并且字节确实看起来更整齐,但仍然像废话一样接缝。相信我,我已经......
  • python - 面板库 - PasswordInput 不会对回车做出反应
    我试图避免需要提交按钮。以下代码当前正在远程jupyter实验室运行。仅当光标焦点从密码小部件中移除后,才会打印该消息。我想要回车来触发消息打印。有什么线索吗?frompanel.widgetsimportPasswordInput,TextInputpn.extension()defon_enter(event=None):message_p......
  • 即使安装了软件包,也找不到 python 模块句子转换器
    对于我的python脚本(如下所示),我使用句子转换器包,其中包含SBERT模型。即使在执行“piplist”时明确列出该软件包,并且还安装了torch,所有内容都更新到最新版本,但仍然找不到该模块。脚本:importnumpyasnpimportpandasaspdfromsentence_transformersimportSenten......
  • 有没有办法在 python 中返回类实例的布尔属性?
    我想组织我玩的游戏中的汽车数据。为此,我创建了一个“Car”类。我希望将此类实例的一些属性作为布尔值,这样我就可以将此类的所有实例放入列表中并过滤它们。我当前的解决方案不起作用,因为,我收到以下错误消息:TypeError:__repr__returnednon-string(typeCar)我使用......
  • python 正则表达式匹配一行中的多个单词而不转到下一行
    我正在编写一个解析器来解析以下输出:admin@str-s6000-on-5:~$showinterfacestatusEthernet4InterfaceLanesSpeedMTUAliasVlanOperAdminTypeAsymPFC------------------------------------------......