簡體   English   中英

使用Python 3和Cython 0.25-2使用Buildozer編譯Kivy

[英]Compiling Kivy with Buildozer using Python 3 and Cython 0.25-2

我無法使用buildozer或p4a進行編譯。 我最接近的是使用buildozer。

  • 我正在使用Kivy 1.10.1;
  • Cython 0.25.2
  • 嘗試使用android-ndk-16b和crystax-10.3.2。
  • 嘗試過也將hostpython3置於要求中,但也不起作用。

我的buildozer.spec的一部分:

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = sqlite3,python3crystax,kivy,datetime,plyer,ecdsa,paramiko,pyjnius

# (int) Android API to use
android.api = 19

# (int) Minimum API required
android.minapi = 13

# (int) Android SDK version to use
android.sdk = 20

# (str) Android NDK version to use
android.ndk = 10.3.2

# (bool) Use --private data storage (True) or --dir public storage (False)
android.private_storage = False

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path = /home/awulll/python-for-android/crystax-ndk-10.3.2/

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
android.sdk_path = /home/awulll/Android/Sdk/

我得到的錯誤:

[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Getting Android API version from user argument
[INFO]:    Available Android APIs are (19, 28)
[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]:    Of the existing distributions, the following meet the given requirements:
[INFO]:     DAP_new: includes recipes (hostpython3crystax, sdl2_image, sdl2_mixer, sdl2_ttf, sqlite3, python3crystax, sdl2, six, pyjnius, kivy, ecdsa, paramiko, plyer, datetime), built for archs (armeabi-v7a)
[INFO]:    DAP_new has compatible recipes, using this one
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:     DAP_new: includes recipes (hostpython3crystax, sdl2_image, sdl2_mixer, sdl2_ttf, sqlite3, python3crystax, sdl2, six, pyjnius, kivy, ecdsa, paramiko, plyer, datetime), built for archs (armeabi-v7a)
[INFO]:    DAP_new has compatible recipes, using this one
[INFO]:    -> directory context /home/awulll/dapapp_new/.buildozer/android/platform/build/dists/DAP_new
usage: toolchain.py [-h] [--private PRIVATE] --package PACKAGE --name NAME
                    [--numeric-version NUMERIC_VERSION] --version VERSION
                    [--orientation ORIENTATION] [--launcher] [--icon ICON]
                    [--permission PERMISSIONS [PERMISSIONS ...]]
                    [--meta-data META_DATA] [--presplash PRESPLASH]
                    [--presplash-color PRESPLASH_COLOR] [--wakelock]
                    [--window] [--blacklist BLACKLIST] [--whitelist WHITELIST]
                    [--add-jar ADD_JAR] [--add-aar ADD_AAR] [--depend DEPENDS]
                    [--sdk SDK_VERSION] [--minsdk MIN_SDK_VERSION]
                    [--intent-filters INTENT_FILTERS] [--service SERVICES]
                    [--add-source EXTRA_SOURCE_DIRS]
                    [--try-system-python-compile] [--no-compile-pyo] [--sign]
toolchain.py: error: unrecognized arguments: --dir /home/awulll/dapapp_new/.buildozer/android/app
b'Could not find hostpython, will not compile to .pyo (this is normal with python3)\n'# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name DAP_new --name DAP_new --version 0.1 --package com.doatlanticoaopacifico.dap_new --android_api 19 --minsdk 13 --dir /home/awulll/dapapp_new/.buildozer/android/app --permission INTERNET --permission ACCESS_NETWORK_STATE --permission CAMERA --presplash /home/awulll/dapapp_new/./data/figura.png --icon /home/awulll/dapapp_new/./data/logo.png --orientation portrait --window --copy-libs --arch armeabi-v7a --color=always --storage-dir="/home/awulll/dapapp_new/.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

有任何想法嗎?

第1版:

我現在使用:“ android.private_storage = True”(之前為False),代碼已編譯,但現在在我的android上折痕了。

在編譯結束時,我收到以下消息:

[DEBUG]:    BUILD SUCCESSFUL
[DEBUG]:    
[DEBUG]:    Total time: 3 mins 46.325 secs
[DEBUG]:    
[INFO]:    <- directory context /home/awulll/dapapp_new/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    # Copying APK to current directory
[INFO]:    # APK filename not found in build output, trying to guess
[INFO]:    # Found APK file: /home/awulll/dapapp_new/.buildozer/android/platform/build/dists/DAP_new/build/outputs/apk/DAP_new-debug.apk
[INFO]:    # Add version number to APK
[INFO]:    # APK renamed to DAP_new-0.1-debug.apk
[DEBUG]:   -> running cp /home/awulll/dapapp_new/.buildozer/android/platform/build/dists/DAP_new/build/outputs/apk/DAP_new-debug.apk DAP_new-0.1-debug.apk
b'Could not find hostpython, will not compile to .pyo (this is normal with python3)\nNo compiled python is present to zip, skipping.\nthis should only be the case if you are using the CrystaX python\n'# Android packaging done!
# APK DAP_new-0.1-debug.apk available in the bin directory
# Run '/home/awulll/Android/Sdk/platform-tools/adb devices'
# Cwd None
* daemon not running; starting now at tcp:5037
* daemon started successfully
b'List of devices attached\n\n'# Application pushed.
# Application started.

第2版​​:

在我的logcat中,我發現了加密錯誤,但是當我將此作為要求時,我無法編譯。 logcat的:

10-15 18:09:58.498 25389 25406 I python  :  Traceback (most recent call last):
10-15 18:09:58.499 25389 25406 I python  :    File "main.py", line 12, in <module>
10-15 18:09:58.500 25389 25406 I python  :      import rotinas
10-15 18:09:58.501 25389 25406 I python  :    File "./rotinas.py", line 11, in <module>
10-15 18:09:58.503 25389 25406 I python  :      import paramiko
10-15 18:09:58.504 25389 25406 I python  :    File "/data/user/0/com.doatlanticoaopacifico.dap_new/files/app/crystax_python/site-packages/paramiko/__init__.py", line 22, in <module>
10-15 18:09:58.506 25389 25406 I python  :      from paramiko.transport import SecurityOptions, Transport
10-15 18:09:58.507 25389 25406 I python  :    File "/data/user/0/com.doatlanticoaopacifico.dap_new/files/app/crystax_python/site-packages/paramiko/transport.py", line 33, in <module>
10-15 18:09:58.511 25389 25406 I python  :      from cryptography.hazmat.backends import default_backend
10-15 18:09:58.512 25389 25406 I python  :  ImportError: No module named 'cryptography'
10-15 18:09:58.657 25389 25406 I python  : Python for android ended.

嘗試使用加密作為要求時發現了新錯誤:

[INFO]:    No dist exists that meets your requirements, so one will be built.
[ERROR]:   Didn't find any valid dependency graphs.
[ERROR]:   This means that some of your requirements pull in conflicting dependencies.
[ERROR]:   Exiting.
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=DAP_new --bootstrap=sdl2 --requirements=sqlite3,python3crystax,kivy,datetime,plyer,ecdsa,paramiko,cryptography,pyjnius --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/awulll/dapapp_new/.buildozer/android/platform/build"
# 

在您的需求行中包含hostpython

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = hostpython3crystax

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM