应用构建在 toolchain.py 中因参数无法识别而产生错误
App construction generates error in toolchain.py by unrecognized argument
版本
Python: 2.7
OS: Linux Lite (Ubuntu)
Kivy: 1.10.1
Cython: 0.22
由于 toolchain.py 和参数 --ndk-api 9 中的错误,Buildozer 未继续创建应用程序。
我切换到所有cython版本从0.21到最新,但没有任何变化。我进入 android sdk 文件夹并进行了几次更新,但问题仍然存在。
错误是:'toolchain.py: error: unrecognized arguments: --ndk-api 9'
日志的最后一部分:
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: --ndk-api 9
# Command failed: /usr/bin/python -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name myapp --name 'My Application' --version 0.1 --package org.test.myapp --android_api 19 --minsdk 9 --ndk-api 9 --private /home/dev/Modelos/testea/.buildozer/android/app --orientation portrait --window --copy-libs --arch armeabi-v7a --color=always --storage-dir="/home/dev/Modelos/testea/.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
有人知道这个错误的原因吗?
对于可能遇到同样问题的其他人,我把我为解决该错误所做的一切都放在这里。
好的,首先,这是一个错误,其中 buildozer.spec 文件出于某种原因没有正确更新 p4a 文件,并且使用的 ndk 版本也有错误。
首先我下载了NDK的r17c版本。我去了 /home/dev/.buildozer/android/platform/
路径并提取下载的文件。
然后在路径 /home/dev/buildozer/buildozer/default.spec
中,我为 master 更改了 p4a 中使用的分支,它看起来像这样:
# p4a.branch = master
我还更改了以下几行:
# (int) Android API to use
# android.api = 21
# (int) Minimum API required. You will need to set the android.ndk.api to be as low as this value.
# android.minapi = 21
# (int) Android SDK version to use
# android.sdk = 20
# (str) Android NDK version to use
# android.ndk = r17c
# (int) Android NDK API to use (optional). This is the minimum API your app will support.
# android.ndk_api = 19
好吧,这最初并没有改变施工的方式,而且它继续犯错误。所以我走上了这条路
/ home / dev / buildozer / buildozer / targets /
在文件 android.py
中,我更改了第 17、18 和 20 行:
ANDROID_API = '21' #line 17
ANDROID_MINAPI = '21' #line 18
ANDROID_SDK_VERSION = '20'
ANDROID_NDK_VERSION = '17c' #line 20
APACHE_ANT_VERSION = '1.9.4'
在同一个文件中,在 TargetAndroid
class 中,我更改了第 46 行(旧名称是 python-for-android-new-version)和47,class 看起来像这样:
class TargetAndroid (Target):
targetname = 'android_old'
p4a_directory = "python-for-android" #line 46
p4a_branch = 'master' #line 47
p4a_apk_cmd = "python build.py"
好的,在这个相同的路径中有一个名为 android_new.py
的文件,在 TargetAndroidNew
class 我更改了第 16 和 17 行, class 看起来像这样:
class TargetAndroidNew (TargetAndroid):
targetname = 'android'
p4a_branch = "master" #line 16
p4a_directory = "python-for-android" #line 17
p4a_apk_cmd = "apk --debug --bootstrap ="
extra_p4a_args = ''
好的,这应该已经可以工作了,但由于某种原因,还有另一条路径包含几乎相同的文件,因此我进行了相同的更改。没有路径
/home/dev/buildozer/build/lib.linux-x86_64-2.7/buildozer/
我像以前一样更改了 default.spec
文件。并在路径中
/home/dev/buildozer/build/lib.linux-x86_64-2.7/buildozer/targets/
我以与之前相同的方式更改了文件 android.py
和 android_new.py
。
现在 buildozer 执行 p4a 和 ndk 的正确更新并正常工作。
版本
Python: 2.7
OS: Linux Lite (Ubuntu)
Kivy: 1.10.1
Cython: 0.22
由于 toolchain.py 和参数 --ndk-api 9 中的错误,Buildozer 未继续创建应用程序。
我切换到所有cython版本从0.21到最新,但没有任何变化。我进入 android sdk 文件夹并进行了几次更新,但问题仍然存在。
错误是:'toolchain.py: error: unrecognized arguments: --ndk-api 9'
日志的最后一部分:
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: --ndk-api 9
# Command failed: /usr/bin/python -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name myapp --name 'My Application' --version 0.1 --package org.test.myapp --android_api 19 --minsdk 9 --ndk-api 9 --private /home/dev/Modelos/testea/.buildozer/android/app --orientation portrait --window --copy-libs --arch armeabi-v7a --color=always --storage-dir="/home/dev/Modelos/testea/.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
有人知道这个错误的原因吗?
对于可能遇到同样问题的其他人,我把我为解决该错误所做的一切都放在这里。
好的,首先,这是一个错误,其中 buildozer.spec 文件出于某种原因没有正确更新 p4a 文件,并且使用的 ndk 版本也有错误。
首先我下载了NDK的r17c版本。我去了 /home/dev/.buildozer/android/platform/
路径并提取下载的文件。
然后在路径 /home/dev/buildozer/buildozer/default.spec
中,我为 master 更改了 p4a 中使用的分支,它看起来像这样:
# p4a.branch = master
我还更改了以下几行:
# (int) Android API to use
# android.api = 21
# (int) Minimum API required. You will need to set the android.ndk.api to be as low as this value.
# android.minapi = 21
# (int) Android SDK version to use
# android.sdk = 20
# (str) Android NDK version to use
# android.ndk = r17c
# (int) Android NDK API to use (optional). This is the minimum API your app will support.
# android.ndk_api = 19
好吧,这最初并没有改变施工的方式,而且它继续犯错误。所以我走上了这条路
/ home / dev / buildozer / buildozer / targets /
在文件 android.py
中,我更改了第 17、18 和 20 行:
ANDROID_API = '21' #line 17
ANDROID_MINAPI = '21' #line 18
ANDROID_SDK_VERSION = '20'
ANDROID_NDK_VERSION = '17c' #line 20
APACHE_ANT_VERSION = '1.9.4'
在同一个文件中,在 TargetAndroid
class 中,我更改了第 46 行(旧名称是 python-for-android-new-version)和47,class 看起来像这样:
class TargetAndroid (Target):
targetname = 'android_old'
p4a_directory = "python-for-android" #line 46
p4a_branch = 'master' #line 47
p4a_apk_cmd = "python build.py"
好的,在这个相同的路径中有一个名为 android_new.py
的文件,在 TargetAndroidNew
class 我更改了第 16 和 17 行, class 看起来像这样:
class TargetAndroidNew (TargetAndroid):
targetname = 'android'
p4a_branch = "master" #line 16
p4a_directory = "python-for-android" #line 17
p4a_apk_cmd = "apk --debug --bootstrap ="
extra_p4a_args = ''
好的,这应该已经可以工作了,但由于某种原因,还有另一条路径包含几乎相同的文件,因此我进行了相同的更改。没有路径
/home/dev/buildozer/build/lib.linux-x86_64-2.7/buildozer/
我像以前一样更改了 default.spec
文件。并在路径中
/home/dev/buildozer/build/lib.linux-x86_64-2.7/buildozer/targets/
我以与之前相同的方式更改了文件 android.py
和 android_new.py
。
现在 buildozer 执行 p4a 和 ndk 的正确更新并正常工作。