\u82f9\u679c\u514d\u7b7e\u540d\u6253\u5305\u8f6f\u4ef6<\/a>ere the main.py live<\/p>\nsource.dir = .<\/p>\n
# (str) Application versioning (method 1)<\/p>\n
version = 0.1<\/p>\n
# (str) Application versioning (method 2)<\/p>\n
version.regex = __version__ = [‘”](.*)[‘”]<\/p>\n
version.filename = %(source.dir)s\/main.py<\/p>\n
# (list) Application requirements<\/p>\n
requirements = kivy<\/p>\n
[buildozer]<\/p>\n
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))<\/p>\n
log_level = 2<\/p>\n
# (str) Path to build artifact storage, absolute or relative to spec file<\/p>\n
# build_dir = .\/.buildozer<\/p>\n
# (str) Path to build output (i.e. .apk, .ipa) storage<\/p>\n
# bin_dir = .\/bin<\/p>\n
# (int) Target Android API, should be as high as possible.<\/p>\n
# android.api = 27<\/p>\n
# (int) Minimum API your APK will support.<\/p>\n
# android.minapi = 21<\/p>\n
# (int) Android SDK version to use<\/p>\n
# android.sdk = 20<\/p>\n
# (str) Android NDK version to use<\/p>\n
# android.ndk = r9c<\/p>\n
# (str) Android NDK directory (if empty, it will be automatically downloaded.)<\/p>\n
# android.ndk_path =<\/p>\n
# (str) Python for android distribution to use, defaults to python2<\/p>\n
# p4a.dist_name = python3crystax<\/p>\n
# (str) ndk platform to use (auto, android-ndk-r9c, android-ndk-r10e, \u2026)<\/p>\n
# android.ndk_platform = android-21<\/p>\n
# (str) Options to pass to android compilation (debug, release, \u2026)<\/p>\n
# android.build_mode = debug<\/p>\n
# (list) Application permissions<\/p>\n
# android.permissions = INTERNET<\/p>\n
# (str) Android logcat filters to use<\/p>\n
# android.logcat_filters = *:S python:D<\/p>\n
# (bool) Copy library instead of making a libpymodules.so<\/p>\n
# android.copy_libs = 1<\/p>\n
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64<\/p>\n
# arch = armeabi-v7a<\/p>\n
# (str) Path to a custom AndroidManifest.xml, relative to the buildozer.spec file<\/p>\n
# android.manifest.filename = .\/AndroidManifest.xml<\/p>\n
# (str) Extra Java compile options<\/p>\n
# android.javac_options = <\/p>\n
# (str) Extra dex options<\/p>\n
# android.dex_options = <\/p>\n
# (bool) Whether to enable the with_ads (admob) directive<\/p>\n
# android.with_ads = 0<\/p>\n
# (bool) Whether to enable the with_billing directive<\/p>\n
# android.with_billing = 0<\/p>\n
# (bool) Whether to enable the with_pygame_sdl2 directive<\/p>\n
# android.with_pygame_sdl2 = 0<\/p>\n
# (bool) Whether to enable the with_recipe directive<\/p>\n
# android.with_recipe = 0<\/p>\n
# (str) A custom android bootanimation (specify a file path, or ‘default’ to use the stock animation)<\/p>\n
# android.bootanimation = default<\/p>\n
# (str) Filename of a custom bootlog to display while booting (boot_progress in the manifest)<\/p>\n
# android.bootlog = <\/p>\n
# (list) Opaque data to pass to the bootstrap<\/p>\n
# bootstrap = <\/p>\n
# (str) Path to a custom whitelist file<\/p>\n
# whitelist =<\/p>\n
# (str) Path to a custom blacklist file<\/p>\n
# blacklist =<\/p>\n
# (list) List of Java .jar files to add to the libs so that pyjnius can access<\/p>\n
# android.add_jars = foo.jar,bar.jar<\/p>\n
# (list) List of Java .aar files to add to the libs.<\/p>\n
# android.add_aars = foo.aar,<\/p>\n
<\/figure>\n<\/p>\nbar.aar<\/p>\n
# (list) Gradle dependencies to add (currently for android only)<\/p>\n
# android.gradle_dependencies = <\/p>\n
# (str) Path to the project directory to use (if not the current directory)<\/p>\n
# android.project_dir = .<\/p>\n
# (str) Path to the Android SDK directory (if empty, it will be automatically downloaded)<\/p>\n
# android.sdk_path =<\/p>\n
# (str) Path to the Android NDK directory (if empty, it will be automatically downloaded)<\/p>\n
# android.ndk_path =<\/p>\n
# (str) Path to a custom Android sources directory<\/p>\n
# android.sources =<\/p>\n
# (list) List of additional Java source folders to include<\/p>\n
# android.java_source_dirs = <\/p>\n
# (list) List of additional C\/C++ source folders to include (will be compiled with the NDK)<\/p>\n
# android.ndk_source_dirs = <\/p>\n
# (list) List of additional Java classes to include from the jar files<\/p>\n
# android.add_jars_classes = com.android.billingclient.api.*<\/p>\n
# (list) List of obfuscated modules<\/p>\n
# obfuscate = <\/p>\n
# (str) The directory in which to place the cache<\/p>\n
# ccache_dir = .ccache<\/p>\n
# (bool) Use prebuild python instead of compiling it (if available)<\/p>\n
# use_pth = true<\/p>\n
# (bool) Show warning when adding Python modules with pip<\/p>\n
# warn_on_pip_install = true<\/p>\n
# (str) Path to a custom prebuilt python<\/p>\n
# prebuilt_path = <\/p>\n
# (str) Path to a custom prebuild python include path<\/p>\n
# prebuilt_includes = <\/p>\n
# (str) Path to a custom prebuild python libs path<\/p>\n
# prebuilt_libs = <\/p>\n
# (list) List of include directories to use with the prebuilt python<\/p>\n
# prebuild_includes = <\/p>\n
# (list) List of library directories to use with the prebuilt python<\/p>\n
# prebuild_libs = <\/p>\n
# (bool) If the application should be fullscreen or not<\/p>\n
fullscreen = 0<\/p>\n
# (str) Presplash of the application<\/p>\n
# presplash.filename = %(source.dir)s\/data\/presplash.png<\/p>\n
# (str) Icon of the application<\/p>\n
# icon.filename = %(source.dir)s\/data\/icon.png<\/p>\n
# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all)<\/p>\n
orientation = portrait<\/p>\n
# (bool) Indicate if the application should be in fullscreen or not<\/p>\n
fullscreen = 0<\/p>\n
# (bool) Enable or disable the cursor<\/p>\n
# cursor = 1<\/p>\n
# (str) Permissions<\/p>\n
# android.permissions = INTERNET<\/p>\n
# (str) Services<\/p>\n
# android.services = <\/p>\n
# (str) Application meta-data to include\/exclude<\/p>\n
# android.meta_data = <\/p>\n
# (str) Launch mode (singleInstance, singleTask, etc)<\/p>\n
# android.launch_mode = standard<\/p>\n
# (bool) If the application should be hidden on launch<\/p>\n
# android.hide_app_window = False<\/p>\n
# (str) If the application should be resizable or not<\/p>\n
# resizable = False<\/p>\n
# (bool) If the application should be able to receive notifications<\/p>\n
# android.allow_notifications = True<\/p>\n
# (str) If the application should be able to receive notifications<\/p>\n
# android.notification_icon = <\/p>\n
# (bool) If the application should be able to receive notifications<\/p>\n
# android.notification_never_sleeps = False<\/p>\n
# (str) Whether to copy library instead of making a libpymodules.so<\/p>\n
# android.copy_libs = 1<\/p>\n
# (list) List of Java .jar files to add to the libs so that pyjnius can access<\/p>\n
# android.add_jars = foo.jar,bar.jar<\/p>\n
# (list) List of Java .aar files to add to the libs.<\/p>\n
# android.add_aars = foo.aar,bar.aar<\/p>\n
# (list) Gradle dependencies to add (currently for android only)<\/p>\n
# android.gradle_dependencies = <\/p>\n
# (list) List of Android assets to copy into the APK. Maps directly to the `source` argument of the `android_new_project.py` script.<\/p>\n
# android.assets = <\/p>\n
# (str) Android logcat filters to use<\/p>\n
# android.logcat_filters = *:S python:D<\/p>\n
# (bool) Whether to use the blacklisted packages<\/p>\n
# android.blacklistedsdk = False<\/p>\n
# (str) How to compile the python code, can be one of (python2, python3, none)<\/p>\n
# python_version = 2<\/p>\n
# (str) The backend to use for the python interpreter<\/p>\n
# backend = sdl2<\/p>\n
# (str) Path to a custom entry point, relative to the buildozer.spec file<\/p>\n
# entrypoint = <\/p>\n
# (list) Path to a custom kivy widget directory (relative to this file)<\/p>\n
# widget = <\/p>\n
# (list) Path to a custom source directory (relative to this file)<\/p>\n
# source.include_exts = py,png,jpg,kv,atlas<\/p>\n
# (list) Path to a custom source directory (relative to this file)<\/p>\n
# source.exclude_exts = spec<\/p>\n
# (list) List of inclusions using pattern matching<\/p>\n
# include_patterns = <\/p>\n
# (list) List of exclusions using pattern matching<\/p>\n
# exclude_patterns = <\/p>\n
# (str) Application versioning (method 1)<\/p>\n
# version = 0.1<\/p>\n
# (str) Application versioning (method\u82f9\u679c\u514d\u7b7e\u7248<\/a> 2)<\/p>\n# version.regex = __version__ = [‘”](.*)[‘”]<\/p>\n
# version.filename = %(source.dir)s\/main.py<\/p>\n
# (list) List of directory path (relative to the buildozer.spec file) to search for anything source-like (e.g. html, images, etc.)<\/p>\n
# source_dirs = <\/p>\n
# (list) List of individual files to copy to the target app. Useful for legal stuff.<\/p>\n
# copy_files = <\/p>\n
# (str) Application name<\/p>\n
# name = myapp<\/p>\n
# (str) Domain of the application (for android)<\/p>\n
# domain = org.myapp<\/p>\n
# (str) Bundle identifier of the application (for iOS)<\/p>\n
# ios.bundle_identifier = org.myapp.myidentifier<\/p>\n
# (str) Title of the application (for iOS)<\/p>\n
# ios.title = My Application<\/p>\n
# (bool) Enable the debug panel<\/p>\n
# debug = False<\/p>\n
# (str) Path to a custom icon<\/p>\n
# icon.filename = %(source.dir)s\/data\/icon.png<\/p>\n
“`<\/p>\n
\u5728buildozer.spec\u6587\u4ef6\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u6307\u5b9a\u5e94\u7528\u7a0b\u5e8f\u540d\u79f0\u3001\u5305\u540d\u3001\u7248\u672c\u53f7\u3001\u4f9d\u8d56\u9879\u7b49\u4fe1\u606f\u3002<\/p>\n
\u63a5\u4e0b\u6765\uff0c\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n
“`<\/p>\n
$ buildozer android debug<\/p>\n
“`<\/p>\n
\u8be5\u547d\u4ee4\u5c06\u4f7f\u7528buildozer.spec\u6587\u4ef6\u4e2d\u6307\u5b9a\u7684\u4fe1\u606f\uff0c\u6784\u5efa\u4e00\u4e2a\u540d\u4e3amyapp-0.1-debug.apk\u7684APK\u6587\u4ef6\u3002<\/p>\n
\u6700\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u8be5APK\u6587\u4ef6\u5b89\u88c5\u5230Android\u8bbe\u5907\u4e0a\uff0c\u5e76\u8fd0\u884c\u6211\u4eec\u7684Python\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n
\u603b\u7ed3<\/p>\n
Python\u4f5c\u4e3a\u4e00\u79cd\u9ad8\u7ea7\u7f16\u7a0b\u8bed\u8a00\uff0c\u4f7f\u7528\u5e7f\u6cdb\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u5c06Python\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210Android APK\u6587\u4ef6\uff0c\u5c31\u9700\u8981\u4f7f\u7528\u4e00\u4e9b\u7279\u6b8a\u7684\u5de5\u5177\uff0c\u5982Buildozer\u6216Kivy\u7b49\u3002\u5728\u6253\u5305\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5c06Python\u89e3\u91ca\u5668\u5d4c\u5165\u5230APK\u6587\u4ef6\u4e2d\uff0c\u5e76\u5c06Python\u4ee3\u7801\u7f16\u8bd1\u4e3a\u672c\u5730\u5e93\u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u6211\u4eec\u53ef\u4ee5\u6210\u529f\u5730\u5c06Python\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210Android APK\u6587\u4ef6\uff0c\u5e76\u5728Android\u8bbe\u5907\u4e0a\u8fd0\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
Python\u4f5c\u4e3a\u4e00\u79cd\u9ad8\u7ea7\u7f16\u7a0b\u8bed\u8a00\uff0c\u4f7f\u7528\u5e7f\u6cdb\uff0c\u5176\u5f3a\u5927\u7684\u529f\u80fd\u548c\u6613\u5b66\u6613\u7528\u7684\u7279\u70b9\uff0c\u4f7f\u5176\u6210\u4e3a\u4e86\u8bb8\u591a\u5f00\u53d1\u8005\u7684\u9996\u9009\u8bed\u8a00\u3002\u7136\u800c\uff0cPython\u5e76\u4e0d\u662f\u4e00\u79cd\u672c\u5730\u652f\u6301\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u8fd9\u4e5f\u5c31\u610f\u5473\u7740Python\u4ee3\u7801\u65e0\u6cd5\u76f4\u63a5\u5728\u79fb\u52a8\u8bbe<\/p>\n","protected":false},"author":23,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[25795,24231,116,41,12],"topic":[],"class_list":["post-27329","post","type-post","status-publish","format-standard","hentry","category-kaifaapp","tag-webclip-app-","tag-wordpress-app","tag-116","tag-41","tag-12"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/27329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=27329"}],"version-history":[{"count":1,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/27329\/revisions"}],"predecessor-version":[{"id":27363,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/27329\/revisions\/27363"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=27329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=27329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=27329"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=27329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}