2
2
Build options
3
3
=============
4
4
5
- This page contains instructions for using some of the specific python-for-android build options.
5
+ This page contains instructions for using different build options.
6
6
7
7
8
- Python version
9
- --------------
10
-
11
- python-for-android now supports building APKs with either python2 or
12
- python3, but these have extra requirements or potential disadvantages
13
- as below.
14
-
8
+ Python versions
9
+ ---------------
15
10
16
11
python2
17
12
~~~~~~~
@@ -47,30 +42,24 @@ Google's official NDK which includes many improvements. You
47
42
python3. You can get it `here
48
43
<https://www.crystax.net/en/download> `__.
49
44
50
- The python3crystax build is is handled quite differently to python2 so
45
+ The python3crystax build is handled quite differently to python2 so
51
46
there may be bugs or surprising behaviours. If you come across any,
52
47
feel free to `open an issue
53
48
<https://github.com/kivy/python-for-android> `__.
54
49
55
- As this build is experimental, some features are missing and
56
- the build is not fully optimised so APKs are probably a little larger
57
- and slower than they need to be. This is currently being addressed,
58
- though it's not clear how the final result will compare to python2.
59
-
60
50
.. _bootstrap_build_options :
61
51
62
- Bootstrap
63
- ---------
52
+ Bootstrap options
53
+ -----------------
64
54
65
- python-for-android supports multiple bootstraps, which contain the app
66
- backend that starts the app and the python interpreter, then
67
- handles interactions with the Android OS.
55
+ python-for-android supports multiple app backends with different types
56
+ of interface. These are called *bootstraps *.
68
57
69
58
Currently the following bootstraps are supported, but we hope that it
70
- it should be easy to add others if your project has different
59
+ should be easy to add others if your project has different
71
60
requirements. `Let us know
72
- <https://groups.google.com/forum/#!forum/python-android> `__ if there
73
- are any improvements that would help here .
61
+ <https://groups.google.com/forum/#!forum/python-android> `__ if you'd
62
+ like help adding a new one .
74
63
75
64
sdl2
76
65
~~~~
@@ -89,6 +78,49 @@ and have them work with this bootstrap. It should also be possible to
89
78
use e.g. pygame_sdl2, but this would need a build recipe and doesn't
90
79
yet have one.
91
80
81
+ Build options
82
+ %%%%%%%%%%%%%
83
+
84
+ The sdl2 bootstrap supports the following additional command line
85
+ options (this list may not be exhaustive):
86
+
87
+ - ``--private ``: The directory containing your project files.
88
+ - ``--package ``: The Java package name for your project. Choose e.g. ``org.example.yourapp ``.
89
+ - ``--name ``: The app name.
90
+ - ``--version ``: The version number.
91
+ - ``--orientation ``: Usually one of ``portait ``, ``landscape ``,
92
+ ``sensor `` to automatically rotate according to the device
93
+ orientation, or ``user `` to do the same but obeying the user's
94
+ settings. The full list of valid options is given under
95
+ ``android:screenOrientation `` in the `Android documentation
96
+ <https://developer.android.com/guide/topics/manifest/activity-element.html> `__.
97
+ - ``--icon ``: A path to the png file to use as the application icon.
98
+ - ``-- permission ``: A permission name for the app,
99
+ e.g. ``--permission VIBRATE ``. For multiple permissions, add
100
+ multiple ``--permission `` arguments.
101
+ - ``--meta-data ``: Custom key=value pairs to add in the application metadata.
102
+ - ``--presplash ``: A path to the image file to use as a screen while
103
+ the application is loading.
104
+ - ``--presplash-color ``: The presplash screen background color, of the
105
+ form ``#RRGGBB `` or a color name ``red ``, ``green ``, ``blue `` etc.
106
+ - ``--wakelock ``: If the argument is included, the application will
107
+ prevent the device from sleeping.
108
+ - ``--window ``: If the argument is included, the application will not
109
+ cover the Android status bar.
110
+ - ``--blacklist ``: The path to a file containing blacklisted patterns
111
+ that will be excluded from the final APK. Defaults to ``./blacklist.txt ``.
112
+ - ``--whitelist ``: The path to a file containing whitelisted patterns
113
+ that will be included in the APK even if also blacklisted.
114
+ - ``--add-jar ``: The path to a .jar file to include in the APK. To
115
+ include multiple jar files, pass this argument multiple times.
116
+ - ``--intent-filters ``: A file path containing intent filter xml to be
117
+ included in AndroidManifest.xml.
118
+ - ``--service ``: A service name and the Python script it should
119
+ run. See :ref: `arbitrary_scripts_services `.
120
+ - ``--add-source ``: Add a source directory to the app's Java code.
121
+ - ``--no-compile-pyo ``: Do not optimise .py files to .pyo.
122
+
123
+
92
124
webview
93
125
~~~~~~~
94
126
@@ -112,6 +144,43 @@ present (e.g. during the short Python loading time when first
112
144
started), it will instead display a loading screen until the server is
113
145
ready.
114
146
147
+ - ``--private ``: The directory containing your project files.
148
+ - ``--package ``: The Java package name for your project. Choose e.g. ``org.example.yourapp ``.
149
+ - ``--name ``: The app name.
150
+ - ``--version ``: The version number.
151
+ - ``--orientation ``: Usually one of ``portait ``, ``landscape ``,
152
+ ``sensor `` to automatically rotate according to the device
153
+ orientation, or ``user `` to do the same but obeying the user's
154
+ settings. The full list of valid options is given under
155
+ ``android:screenOrientation `` in the `Android documentation
156
+ <https://developer.android.com/guide/topics/manifest/activity-element.html> `__.
157
+ - ``--icon ``: A path to the png file to use as the application icon.
158
+ - ``-- permission ``: A permission name for the app,
159
+ e.g. ``--permission VIBRATE ``. For multiple permissions, add
160
+ multiple ``--permission `` arguments.
161
+ - ``--meta-data ``: Custom key=value pairs to add in the application metadata.
162
+ - ``--presplash ``: A path to the image file to use as a screen while
163
+ the application is loading.
164
+ - ``--presplash-color ``: The presplash screen background color, of the
165
+ form ``#RRGGBB `` or a color name ``red ``, ``green ``, ``blue `` etc.
166
+ - ``--wakelock ``: If the argument is included, the application will
167
+ prevent the device from sleeping.
168
+ - ``--window ``: If the argument is included, the application will not
169
+ cover the Android status bar.
170
+ - ``--blacklist ``: The path to a file containing blacklisted patterns
171
+ that will be excluded from the final APK. Defaults to ``./blacklist.txt ``.
172
+ - ``--whitelist ``: The path to a file containing whitelisted patterns
173
+ that will be included in the APK even if also blacklisted.
174
+ - ``--add-jar ``: The path to a .jar file to include in the APK. To
175
+ include multiple jar files, pass this argument multiple times.
176
+ - ``--intent-filters ``: A file path containing intent filter xml to be
177
+ included in AndroidManifest.xml.
178
+ - ``--service ``: A service name and the Python script it should
179
+ run. See :ref: `arbitrary_scripts_services `.
180
+ - ``add-source ``: Add a source directory to the app's Java code.
181
+ - ``--port ``: The port on localhost that the WebView will
182
+ access. Defaults to 5000.
183
+
115
184
116
185
pygame
117
186
~~~~~~
@@ -126,3 +195,45 @@ apps, but hasn't been developed with this in mind.
126
195
This bootstrap will eventually be deprecated in favour of sdl2, but
127
196
not before the sdl2 bootstrap includes all the features that would be
128
197
lost.
198
+
199
+ Build options
200
+ %%%%%%%%%%%%%
201
+
202
+ The pygame bootstrap supports the following additional command line
203
+ options (this list may not be exhaustive):
204
+
205
+ - ``--private ``: The directory containing your project files.
206
+ - ``--dir ``: The directory containing your project files if you want
207
+ them to be unpacked to the external storage directory rather than
208
+ the app private directory.
209
+ - ``--package ``: The Java package name for your project. Choose e.g. ``org.example.yourapp ``.
210
+ - ``--name ``: The app name.
211
+ - ``--version ``: The version number.
212
+ - ``--orientation ``: One of ``portait ``, ``landscape `` or ``sensor ``
213
+ to automatically rotate according to the device orientation.
214
+ - ``--icon ``: A path to the png file to use as the application icon.
215
+ - ``--ignore-path ``: A path to ignore when including the app
216
+ files. Pass multiple times to ignore multiple paths.
217
+ - ``-- permission ``: A permission name for the app,
218
+ e.g. ``--permission VIBRATE ``. For multiple permissions, add
219
+ multiple ``--permission `` arguments.
220
+ - ``--meta-data ``: Custom key=value pairs to add in the application metadata.
221
+ - ``--presplash ``: A path to the image file to use as a screen while
222
+ the application is loading.
223
+ - ``--wakelock ``: If the argument is included, the application will
224
+ prevent the device from sleeping.
225
+ - ``--window ``: If the argument is included, the application will not
226
+ cover the Android status bar.
227
+ - ``--blacklist ``: The path to a file containing blacklisted patterns
228
+ that will be excluded from the final APK. Defaults to ``./blacklist.txt ``.
229
+ - ``--whitelist ``: The path to a file containing whitelisted patterns
230
+ that will be included in the APK even if also blacklisted.
231
+ - ``--add-jar ``: The path to a .jar file to include in the APK. To
232
+ include multiple jar files, pass this argument multiple times.
233
+ - ``--intent-filters ``: A file path containing intent filter xml to be
234
+ included in AndroidManifest.xml.
235
+ - ``--service ``: A service name and the Python script it should
236
+ run. See :ref: `arbitrary_scripts_services `.
237
+ - ``add-source ``: Add a source directory to the app's Java code.
238
+ - ``--compile-pyo ``: Optimise .py files to .pyo.
239
+ - ``--resource ``: A key=value pair to add in the string.xml resource file.
0 commit comments