Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将python版本和需求放入buildozer规范文件的正确方法是什么?_Python_Android_Kivy_Kivy Language_Buildozer - Fatal编程技术网

将python版本和需求放入buildozer规范文件的正确方法是什么?

将python版本和需求放入buildozer规范文件的正确方法是什么?,python,android,kivy,kivy-language,buildozer,Python,Android,Kivy,Kivy Language,Buildozer,在使用android或IOS构建kivy应用程序时,这确实令人困惑。文档中没有提供将依赖项和需求放在buildozer规范文件中的正确方法 现在,我使用kivy框架构建了一个应用程序,我想构建一个.apk文件,将其部署到android上。我使用buildozer来构建apk文件,因为它是文档中推荐的方法 应用程序在我的笔记本电脑上运行perfecty,buildozer日志显示没有错误,事实上,它在作业结束时为我提供了一个成功的构建。不幸的是,在我的android手机上部署并安装了apk文件后,

在使用android或IOS构建kivy应用程序时,这确实令人困惑。文档中没有提供将依赖项和需求放在buildozer规范文件中的正确方法

现在,我使用kivy框架构建了一个应用程序,我想构建一个.apk文件,将其部署到android上。我使用buildozer来构建apk文件,因为它是文档中推荐的方法

应用程序在我的笔记本电脑上运行perfecty,buildozer日志显示没有错误,事实上,它在作业结束时为我提供了一个成功的构建。不幸的是,在我的android手机上部署并安装了apk文件后,应用程序崩溃了。用户界面根本不显示,我点击图标后应用程序直接崩溃

由于没有日志错误,我假设这与我如何构建应用程序有关,或者更准确地说,与buildozer规范文件有关。这是我的buildozer规范文件:

[app]

# (str) Title of your application
title = Overall Translator

# (str) Package name
package.name = overallTranslator

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

# (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,ttf

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

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

# (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
#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 = hostpython3==3.7.8,python3==3.7.8,kivy==1.11.1, beautifulsoup4, bs4, certifi,chardet,docutils, future, idna, Kivy-Garden, Pygments, requests, six, soupsieve, urllib3, deep-translator, arabic-reshaper, python-bidi, openssl

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy

# (list) Garden requirements
#garden_requirements =

# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png

# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png

# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all)
orientation = portrait

# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY

#
# OSX Specific
#

#
# author = © Copyright Info

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

# Kivy version to use
osx.kivy_version = 1.9.1

#
与任何项目一样,我的项目也有依赖关系,我应该将需求放在spec文件中。这是令人困惑的,因为没有描述如何以正确的方式进行。例如,我有只在python>=3.7上工作的库,我如何在需求中提供这一点?在上面的spec文件中,我这样做对吗

此外,我是否以正确的方式提供每个包的版本?我希望有人能帮我,因为我真的不知道该怎么办。几天前我发布了一篇文章,当我在手机上打开应用程序时,我提供了构建和调试模式的日志输出,但是我没有收到任何有用的信息。请查看前面的问题日志,我非常感谢您提供的任何信息

将python版本和需求放入buildozer规范文件的正确方法是什么

对此的直接答案是使用buildozer.spec行
requirements=hostpython3==3.7.8,python3==3.7.8
“您完成它的方式”。唯一需要注意的是,并非所有次要的python版本都能正常工作,我不知道3.7.8是否良好。如果可能的话,最好使用默认值,在本例中,将使用Python3.8(但是您需要清理构建并再次运行以实现这一点)。然而,一个不好的次要版本的主要问题会导致编译失败,所以这可能不是你的问题


你的问题显然是在问“为什么我的应用程序会崩溃?”。我建议单独问这个问题,并包括完整的logcat输出。这可能比猜测原因并询问原因更有效率。

不要猜测。发布运行应用程序的logcat输出。也不要尝试指定python版本,只让buildozer使用默认版本(3.8)。@Sarment I更新并发布了前一个问题中的logcat。我尝试不指定python版本,但这没有帮助您问了一个新问题,请求调试失败的帮助,因此您需要包含包含调试所用详细信息的logcat输出。你也把它贴在另一个问题上并不重要。