使用Buildozer部署Kivy到移动设备上

在安装好Buildozer软件之后,我们在包含main.py的文件夹下运行buildozer init这个命令,然后我们就会看到在该文件夹下有一个buildozer.spec这个文件,这个文件主要是用来配置一系列设置用的,使用文本编辑器,Linux下使用vim编辑器打开。
下面是个例子:

[app]
# (str) Title of your application 更改1
title = Test
# (str) Package name 更改2
package.name = test
# (str) Package domain (needed for android/ios packaging)
package.domain = org.example
# (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) 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
# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg
# (str) Application versioning (method 1)
# version.regex = __version__ = ‘(.*)‘
# version.filename = %(source.dir)s/main.py
# (str) Application versioning (method 2) 更改3
version = 0.1
# (list) Application requirements 更改4
requirements = kivy
# (str) Presplash of the application 更改5
presplash.filename = %(source.dir)s/data/presplash.png
# (str) Icon of the application 更改6
icon.filename = %(source.dir)s/data/icon.png
# (str) Supported orientation (one of landscape, portrait or all) 更改7
orientation = all
# (bool) Indicate if the application should be fullscreen or not 更改8
fullscreen = 0

#
# Android specific 更改9
#
# (list) Permissions
android.permissions = INTERNET
# (int) Android API to use 更改10
android.api = 19
# (int) Minimum API required (8 = Android 2.2 devices)
# 更改11
android.minapi = 9
# (int) Android SDK version to use 更改12
android.sdk = 20
# (str) Android NDK version to use 更改13
android.ndk = 9c
# (bool) Use --private data storage (True) or --dir public storage (False)
android.private_storage = True
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
#android.ndk_path =
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
#android.sdk_path =
# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity
# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don‘t add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar
# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
#android.add_src =
# (str) python-for-android branch to use, if not master, useful to try
# not yet merged features.
#android.branch = master
# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
#android.ouya.category = APP
# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png
# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =
# (list) Android additionnal libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
# (bool) Indicate whether the screen should stay on
# Don‘t forget to add the WAKE_LOCK permission if you set this to True
#android.wakelock = False
# (list) Android application meta-data to set (key=value format)
#android.meta_data =
# (list) Android library project to add (will be added in the
# project.properties automatically.)
#android.library_references =
#
# iOS specific
#
# (str) Name of the certificate to use for signing the debug version
# Get a list of available identities: buildozer ios list_identities
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"
# (str) Name of the certificate to use for signing the release version
#ios.codesign.release = %(ios.codesign.debug)s

[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output)) 更改14
log_level = 2
# -----------------------------------------------------------------------------
# List as sections
#
# You can define all the "list" as [section:key].
# Each line will be considered as a option to the list.
# Let‘s take [app] / source.exclude_patterns.
# Instead of doing:
#
# [app]
# source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
# This can be translated into:
#
# [app:source.exclude_patterns]
# license
# data/audio/*.wav
# data/images/original/*
#
# -----------------------------------------------------------------------------
# Profiles
#
# You can extend section / key with a profile
# For example, you want to deploy a demo version of your application without
# HD content. You could first change the title to add "(demo)" in the name
# and extend the excluded directories to remove the HD content.
#
# [[email protected]]
# title = My Application (demo)
#
# [app:[email protected]]
# images/hd/*
#
# Then, invoke the command line with the "demo" profile:
#
# buildozer --profile demo android debug
总共做了14个更改。

title
为了避免某些字符可能引起的不工作,最好避免过长的标题,太长的标题到时候也可能不适应在App的图标下。

package.name
package.name只能是一个单词,只能是由ASCII字符或数字组成,不应该包含特殊字符。比如说,如果你的应用叫Test One,那么package name就应该写成 testone。

package.domain
这个应该填写的是制作这个App的公司或个人的名称,domain+name将会成为该应用对于Android 或iOS的标识。

source.dir
填写包含main.py这些文件的目录路径,默认是在buildozer.spec所在的目录。

source.include_exts
设置将扩展名符合该规则的文件包含进来。如果想将所有属于你自己的扩展名文件包含进来,直接将该值设置为空值,这样就能将所有东西包含进来了。

source.exclude_exts
跟上面相对应的,这里设置的是不将符合该规则扩展名的文件包含进来。

source.exclude_dirs
这里设置的是不将符合该规则的目录包含进来。比如说,如果不想将tests和bin目录包含进来的话,就进行如下设置。

source.exclude_dirs = tests, bin
version.regex
使用正则表达式去捕捉version.filename文件内的version信息。默认的捕捉方法是在main.py里面查找类似下面一行的内容。
__version__ = "1.0"
version.filename
默认是指main.py文件

version
用来自己手动设置version,如果你不想用捕捉的方法获取到version的话,你可以将version.regex 和 version.filename给注释掉,然后给version赋一个值,例如。

# version.regex =
# version.filename =
version = 1.0
requirements
填写该App所需要的Python的模块或扩展模块

presplash.filename
Presplash是应用刚打开加载时显示的图像,对于不同的平台presplash可能会有不同的要求,目前Buildozer在该方面对于Android的支持要好于iOS。图片的类型必须是JPG或PNG的,最好是2次幂的尺寸,比如说512X512类型的图片对于所有的机器运行都很好。Presplash图片是不会自己适应、伸缩屏幕的,如果提供在尺寸的图片,可能就不适合在小屏幕的机器上显示。

icon.filename
应用的图标,作为图标的图片必须是512X512而且是PNG格式的,这样才能够适应很多平台的要求。

orientation
指明该App支持的显示方向,默认是landscape(横向显示),也可以更改为portrait(竖向显示)或者是全部。

fullscreen
该值为布尔类型的,默认是true,这样App就会运行在全屏的状态了,意味着状态栏将会被隐藏。如果想要让用户能够看到状态栏、时间、通知等内容的话,就应该将该值设置为0。

  

时间: 2024-08-27 23:32:45

使用Buildozer部署Kivy到移动设备上的相关文章

iOS企业版app部署到自己服务器,不通过AppStore,在iOS设备上直接安装应用程序

iOS企业版app部署到服务器 .正对ios升级得ios7 以后,plist文件必须放到 https得服务器上了,http不可以用了 .plist参照模板如下: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyLis

Android设备上i-jetty环境的搭建-手机上的web服务器

本文主要跟大家分享如何将一台Android设备打造成一个web服务器使用. 编译i-jetty 1.将源码download下来,http://code.google.com/p/i-jetty/downloads/list 2.解压文件,进入pom.xml所在目录,执行命令:mvncleaninstall,参照(http://code.google.com/p/i-jetty/wiki/BuildInstructions) 执行过程中,出现了异常导致失败,是生成classes.dex时内存溢出的

不通过AppStore,在iOS设备上直接安装应用程序的原理

本文转载至  http://mobile.51cto.com/hot-439095.htm 通过itms-services协议,可以通过safari浏览器直接在iOS设备上安装应用程序.利用这种方式,只要在内网布置一个服务器,测试人员只需要通过测试设备的safari浏览器访问特定的url既可以实现安装,然后测试了. AD:WOT2015 互联网运维与开发者大会 热销抢票 通过itms-services协议,可以通过safari浏览器直接在iOS设备上安装应用程序.利用这种方式,只要在内网布置一个

在H3C设备上配置IPSec VPN

全网互通实现 现在开始做IPSec VPN H3C企业VPN解决方案 某医疗器械公司随着业务的扩大,在深圳建立分公司.公司数据业务由总公统一处理,数据的安全性尤为重要,H3C提出VPN解决方案,总公司与分公司部署H3C MSR50.MSR30路由器,配置IPSec VPN 保证数据的安全传输. [BJ](应该先命名的) The device is running! ############ <Huawei> Mar 29 2014 15:25:48-05:13 Huawei %%01IFPDT

“解救”程序猿, i.MX6Ul让您的设备上“云”更简单

2019年--都知道物联网行业将会是一个互联互通的落地年,届时会有更多的设备接入云端,利用云端的优势节省成本,掌控数据,对客户进行精准远程服务,将一次销售变为终身销售.虽然设备上云已经成为不可逆转的发展趋势,但是设备上云仍然面临着许多复杂的挑战. 一.开发的难度身为嵌入式开发者的你一定经常为设备上云而伤神,繁琐的上云步骤.复杂的环境配置,两个工程师因为设备端与云端协议是否互通经常是"拳脚相加". 整体开发工作量大.效率低.物联网世界看似美好,实则折腾不起. 二.设备的稳定和性能传统物联

Mysql 5.7 JSON 与 物联网设备上数完美结合

MySQL 5.7.15 新特性一 (json) 更多更浓参考官网 https://dev.mysql.com/doc/refman/5.7/en/json.html 一.测试过程 1.创建库表 create database veh_history; use veh_history; CREATE TABLE `t_equipment_traffic` (   `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键',   `cn` char

基于docker、kubernetes部署openstack到atomic系统上

声明: 本人阅读笔记,翻译类文章仅作意译.如有不对之处,请指出. 需要更本源的理解,请自行阅读英文. 本博客欢迎转发,但请保留原作者信息! 博客地址:http://blog.csdn.net/halcyonbaby 新浪微博:寻觅神迹 内容系本人学习.研究和总结,如有雷同,实属荣幸! 基于docker.kubernetes部署openstack到atomic系统上 openstack的服务定义,是不是看起来很简洁? openstack的实际组件构成,是不是看起来很复杂? 所有的openstack

如何在移动设备上调试网页

这篇文章所讲到的方法已经过时,请移步<移动端真机调试终极利器-BrowserSync>,欢迎分享更多工具. 手机端页面,大多运行在webkit内核的浏览器上,但还是会因平台.厂商的不同而有种种兼容性问题.下面就介绍一下在iOS和Android两个平台上如何在真机上对页面进行调试.这里要说明的是,iOS平台只能用自带的Safari浏览器来调试,而Android平台也只能用google Chrome浏览器来调试.当然,我目前只发现这么两种手段,如果你还有其他方法可调试更多的浏览器,希望你能留言告诉

使IFRAME在iOS设备上支持滚动

原文链接: Scroll IFRAMEs on iOS原文日期: 2014年07月02日 翻译日期: 2014年07月10日翻译人员: 铁锚 很长时间以来, iOS设备上Safari中超出边界的元素将不能滚动,处理这种问题对开发人员来说一直是种折磨. 对原文作者的博客来说,这特别让人无奈,因为demo程序都是在沙箱IFRAMEs中运行的,这是为了不影响博客网站的AJAX页面加载策略.  通过一些研究发现,只要设置两个CSS属性,以及加上一个元素,这个问题就解决了. Here we go!(译者注