標籤:spec android l design 隱藏 sts include developer sse 配置
在安裝好Buildozer軟體之後,我們在包含main.py的檔案夾下運行buildozer init這個命令,然後我們就會看到在該檔案夾下有一個buildozer.spec這個檔案,這個檔案主要是用來配置一系列設定用的,使用文字編輯器,Linux下使用vim編輯器開啟。 下面是個例子:[app]# (str) Title of your application 更改1title = Test# (str) Package name 更改2package.name = test# (str) Package domain (needed for android/ios packaging)package.domain = org.example# (str) Source code where the main.py livesource.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) 更改3version = 0.1# (list) Application requirements 更改4requirements = kivy# (str) Presplash of the application 更改5presplash.filename = %(source.dir)s/data/presplash.png# (str) Icon of the application 更改6icon.filename = %(source.dir)s/data/icon.png# (str) Supported orientation (one of landscape, portrait or all) 更改7orientation = all# (bool) Indicate if the application should be fullscreen or not 更改8fullscreen = 0## Android specific 更改9## (list) Permissionsandroid.permissions = INTERNET# (int) Android API to use 更改10android.api = 19# (int) Minimum API required (8 = Android 2.2 devices)# 更改11android.minapi = 9# (int) Android SDK version to use 更改12android.sdk = 20# (str) Android NDK version to use 更改13android.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)) 更改14log_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, binversion.regex 使用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.0requirements 填寫該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。
使用Buildozer部署Kivy到行動裝置上