s = kivy
[buildozer]
# (int) Log level (0 = error only, 1 = info, 2 = dflutter ios 打包發布ebug (with command output))
log_level = 2
# (str) Path to the android ndk
android.ndk_path = /path/to/android/ndk
# (str) Path to the android sdk
android.sdk_path = /path/to/android/sdk
# (str) Android API to use
android.api = 19
# (str) Minimum API required
android.minapi = 9
# (str) Android NDK version to use
android.ndk = 8c
# (str) Python for android distribution to use
android.python = 2.7
# (list) List of inclusions using pattern matching
include_patterns = assets/*,images/*.png
# (list) List of exclusions using pattern matching
exclude_patterns = license,README.md
# (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 for optional SDK modules (comma separated)
android.arch = x86
# (str) OUYA Console category
ouya.category = GAME
# (str) Filename of OUYA Console icon
ouya.icon.filename = %(source.dir)s/data/icon.png
# (str) XML file to include as an intent filters in tag
android.manifest.intent_filters = intent_filters.xml
“`
4. 打包應用程序
在終端中,使用buildozer android debug命令來打包應用程序。這將使用Buildozer.spec文件中的配置信息來編譯應用程序。
“`
buildozer android debug
“`
5. 安裝應用程序
將生成的APK文件復制到Android設備上,并在設備上安裝它。可以使用adb install命令來安裝應用程序。
“`
adb install HelloWorld-0.1-debug.apk
“`
總結:
將Python文件打包成APK需要使用Kivy和Buildozer這兩個工具。使用Buildozer.spec文件來配置打包應用程序的設置,然后使用buildozer android debug命令來打包應用程序。最后,將生成的APK文件復制到Android設備上并安裝即可。