質問編集履歴

3

情報の追加

2020/05/21 02:00

投稿

groggy_egg
groggy_egg

スコア24

test CHANGED
File without changes
test CHANGED
@@ -252,6 +252,8 @@
252
252
 
253
253
  ```
254
254
 
255
+
256
+
255
257
  何が原因でエラーになってるかわかりません。
256
258
 
257
259
 

2

エラーコードの不要と思われる部分を削除、追記

2020/05/21 02:00

投稿

groggy_egg
groggy_egg

スコア24

test CHANGED
File without changes
test CHANGED
@@ -102,7 +102,7 @@
102
102
 
103
103
  export ANDROIDSDK="$HOME/ProgramFiles/android-sdk/tools/bin"
104
104
 
105
- export ANDROIDNDK="$HOME/Documents/android-ndk-r17c"
105
+ export ANDROIDNDK="$HOME/ProgramFiles/android-ndk-r17c"
106
106
 
107
107
  export ANDROIDAPI="20"
108
108
 

1

エラーコードの不要と思われる部分を削除、追記

2020/05/20 03:19

投稿

groggy_egg
groggy_egg

スコア24

test CHANGED
@@ -1 +1 @@
1
- buildozerでapk化がうまくいか
1
+ buildozerでandroid debug するとエラーに
test CHANGED
@@ -16,55 +16,85 @@
16
16
 
17
17
 
18
18
 
19
-
20
-
21
- **テストコード**
22
-
23
- ```python
24
-
25
- # main.py
26
-
27
- from kivy.app import App
28
-
29
- from kivy.uix.label import Label
30
-
31
-
32
-
33
- class HelloApp(App):
34
-
35
- def build(self):
36
-
37
- return Label(text='Hello World')
38
-
39
-
40
-
41
- if __name__ == '__main__':
42
-
43
- HelloApp().run()
44
-
45
- ```
46
-
47
-
48
-
49
- `buildozer.spec`の変更箇所
50
-
51
- ```
52
-
53
- title = Test Application
54
-
55
- package.name = testapp
56
-
57
- source.dir = /media/sf_VM-share
58
-
59
- requirements = python3,kivy
60
-
61
- p4a.branch = develop
62
-
63
- log_level = 2
64
-
65
- ```
66
-
67
- PATHはbashrcに設定しました([参考](https://python-for-android.readthedocs.io/en/latest/quickstart/#installing-android-sdk))
19
+ 実行結果
20
+
21
+ ```
22
+
23
+ ~$ buildozer android debug logcat
24
+
25
+ :
26
+
27
+ import imp
28
+
29
+ [WARNING]: Unable to read the NDK version from the given directory /home/ubun/.buildozer/android/platform/android-ndk-r19c.
30
+
31
+ [WARNING]: Make sure your NDK version is greater than 19. If you get build errors, download the recommended NDK 19c from https://developer.android.com/ndk/downloads/.
32
+
33
+ [WARNING]: ndk_platform doesn't exist: /home/ubun/.buildozer/android/platform/android-ndk-r19c/platforms/android-21/arch-arm
34
+
35
+ [WARNING]: Could not find toolchain subdirectory!
36
+
37
+ [WARNING]: Could not find any toolchain for arm-linux-androideabi!
38
+
39
+ Traceback (most recent call last):
40
+
41
+ :
42
+
43
+ File "/home/ubun/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 408, in prepare_build_environment
44
+
45
+ self.toolchain_version = toolchain_version
46
+
47
+ UnboundLocalError: local variable 'toolchain_version' referenced before assignment
48
+
49
+ # Command failed: /usr/local/bin/python3.8 -m pythonforandroid.toolchain create --dist_name=testapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/ubun/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21
50
+
51
+ :
52
+
53
+ ```
54
+
55
+
56
+
57
+ **試したこと**
58
+
59
+ - sudo で実行
60
+
61
+ - NDKのバージョンが読み取れないと指摘されていたのでr19cのNDKに変更して実行
62
+
63
+ - APIレベル27(Android8.1)のSDKに変更して実行
64
+
65
+ 以上の結果も同じエラーになりました。
66
+
67
+
68
+
69
+ ---
70
+
71
+
72
+
73
+ **追記**
74
+
75
+ [こちら](https://qiita.com/gotta_dive_into_python/items/f3a6a2c83ed96366bc2f)と[リンク](https://github.com/kivy/kivy/wiki/Android-SDK-NDK-Information)を参考
76
+
77
+ - SDKのAPIレベルを20に変更
78
+
79
+ - NDKをr17cに変更
80
+
81
+ - main.pyと同じディレクトリにSDK,NDK,specを移動
82
+
83
+
84
+
85
+ `buildozer.spec`の設定
86
+
87
+ ```
88
+
89
+ android.ndk_path=/android-ndk-r17c
90
+
91
+ android.sdk_path=/android-sdk
92
+
93
+ ```
94
+
95
+
96
+
97
+ `bashrc`の設定([参考](https://python-for-android.readthedocs.io/en/latest/quickstart/#installing-android-sdk))
68
98
 
69
99
  ```
70
100
 
@@ -72,315 +102,143 @@
72
102
 
73
103
  export ANDROIDSDK="$HOME/ProgramFiles/android-sdk/tools/bin"
74
104
 
75
- #export ANDROIDNDK="$HOME/Documents/android-ndk-r21"
76
-
77
- export ANDROIDNDK="$HOME/Documents/android-ndk-r19c"
78
-
79
- export ANDROIDAPI="27"
80
-
81
- export NDKAPI="19"
82
-
83
- export ANDROIDKVER="r19c"
84
-
85
- ```
86
-
87
-
88
-
89
- ---
90
-
91
-
92
-
93
- 実行結果
94
-
95
- ```
96
-
97
- ~$ buildozer android debug logcat
98
-
99
- # Check configuration tokens
100
-
101
- # Ensure build layout
102
-
103
- # Check configuration tokens
104
-
105
- # Preparing build
106
-
107
- # Check requirements for android
108
-
109
- # Run 'dpkg --version'
110
-
111
- # Cwd None
112
-
113
- Debian `dpkg' パッケージ管理プログラム バージョン 1.18.4 (amd64)。
114
-
115
- これはフリーソフトです; コピー条件については GNU 一般公有使用許諾書バージョン 2
116
-
117
- もしくはそれ以降を参照してください。このソフトウェアは無保証です。
118
-
119
- # Search for Git (git)
120
-
121
- # -> found at /usr/bin/git
122
-
123
- # Search for Cython (cython)
124
-
125
- # -> found at /home/ubun/.local/bin/cython
126
-
127
- # Search for Java compiler (javac)
128
-
129
- # -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
130
-
131
- # Search for Java keytool (keytool)
132
-
133
- # -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
134
-
135
- # Install platform
136
-
137
- # Run 'git config --get remote.origin.url'
138
-
139
- # Cwd /home/ubun/.buildozer/android/platform/python-for-android
140
-
141
- https://github.com/kivy/python-for-android.git
142
-
143
- # Run 'git branch -vv'
144
-
145
- # Cwd /home/ubun/.buildozer/android/platform/python-for-android
146
-
147
- * develop d96d71e [origin/develop] Merge pull request #2205 from AndreMiras/feature/troubleshooting_ssl_error
148
-
149
- # Run '/usr/local/bin/python3.8 -m pip install -q --user \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'six\' \'enum34; python_version<"3.4"\' \'sh>=1.10; sys_platform!="nt"\' \'pep517<0.7.0"\' \'toml\''
150
-
151
- # Cwd None
152
-
153
- # Apache ANT found at /home/ubun/.buildozer/android/platform/apache-ant-1.9.4
154
-
155
- # Android SDK found at /home/ubun/.buildozer/android/platform/android-sdk
156
-
157
- # Recommended android's NDK version by p4a is: 19c
158
-
159
- # Android NDK found at /home/ubun/.buildozer/android/platform/android-ndk-r19c
160
-
161
- # Check application requirements
162
-
163
- # Check garden requirements
164
-
165
- # Compile platform
166
-
167
- # Run '/usr/local/bin/python3.8 -m pythonforandroid.toolchain create --dist_name=testapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/ubun/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21'
168
-
169
- # Cwd /home/ubun/.buildozer/android/platform/python-for-android
170
-
171
- /home/ubun/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py:84: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
172
-
173
- import imp
174
-
175
- [INFO]: Will compile for the following archs: armeabi-v7a
176
-
177
- [INFO]: Found Android API target in $ANDROIDAPI: 27
178
-
179
- [INFO]: Available Android APIs are (27)
180
-
181
- [INFO]: Requested API target 27 is available, continuing.
182
-
183
- [INFO]: Found NDK dir in $ANDROIDNDK: /home/ubun/.buildozer/android/platform/android-ndk-r19c
184
-
185
- [INFO]: Could not determine NDK version, no source.properties in the NDK dir.
186
-
187
- [WARNING]: Unable to read the NDK version from the given directory /home/ubun/.buildozer/android/platform/android-ndk-r19c.
188
-
189
- [WARNING]: Make sure your NDK version is greater than 19. If you get build errors, download the recommended NDK 19c from https://developer.android.com/ndk/downloads/.
190
-
191
- [INFO]: Getting NDK API version (i.e. minimum supported API) from user argument
192
-
193
- [WARNING]: ndk_platform doesn't exist: /home/ubun/.buildozer/android/platform/android-ndk-r19c/platforms/android-21/arch-arm
194
-
195
- [WARNING]: Could not find toolchain subdirectory!
196
-
197
- [WARNING]: Could not find any toolchain for arm-linux-androideabi!
198
-
199
- Traceback (most recent call last):
200
-
201
- File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
202
-
203
- return _run_code(code, main_globals, None,
204
-
205
- File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
206
-
207
- exec(code, run_globals)
208
-
209
- File "/home/ubun/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1243, in <module>
210
-
211
- main()
212
-
213
- File "/home/ubun/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
214
-
215
- ToolchainCL()
216
-
217
- File "/home/ubun/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 692, in __init__
218
-
219
- getattr(self, command)(args)
220
-
221
- File "/home/ubun/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 144, in wrapper_func
222
-
223
- ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
224
-
225
- File "/home/ubun/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 408, in prepare_build_environment
226
-
227
- self.toolchain_version = toolchain_version
228
-
229
- UnboundLocalError: local variable 'toolchain_version' referenced before assignment
230
-
231
- # Command failed: /usr/local/bin/python3.8 -m pythonforandroid.toolchain create --dist_name=testapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/ubun/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21
232
-
233
- # ENVIRONMENT:
234
-
235
- # XDG_VTNR = '7'
236
-
237
- # XDG_SESSION_ID = 'c1'
238
-
239
- # XDG_GREETER_DATA_DIR = '/var/lib/lightdm-data/ubun'
240
-
241
- # CLUTTER_IM_MODULE = 'xim'
242
-
243
- # SESSION = 'ubuntu'
244
-
245
- # ANDROID_HOME = '/home/ubun/ProgramFiles/android-sdk'
246
-
247
- # GPG_AGENT_INFO = '/home/ubun/.gnupg/S.gpg-agent:0:1'
248
-
249
- # TERM = 'xterm-256color'
250
-
251
- # VTE_VERSION = '4205'
252
-
253
- # XDG_MENU_PREFIX = 'gnome-'
254
-
255
- # SHELL = '/bin/bash'
256
-
257
- # QT_LINUX_ACCESSIBILITY_ALWAYS_ON = '1'
258
-
259
- # WINDOWID = '62914570'
260
-
261
- # UPSTART_SESSION = 'unix:abstract=/com/ubuntu/upstart-session/1000/1181'
262
-
263
- # GNOME_KEYRING_CONTROL = ''
264
-
265
- # GTK_MODULES = 'gail:atk-bridge:unity-gtk-module'
266
-
267
- # USER = 'ubun'
268
-
269
- # LS_COLORS = '***'
270
-
271
- # QT_ACCESSIBILITY = '1'
272
-
273
- # UNITY_HAS_3D_SUPPORT = 'true'
274
-
275
- # XDG_SESSION_PATH = '/org/freedesktop/DisplayManager/Session0'
276
-
277
- # XDG_SEAT_PATH = '/org/freedesktop/DisplayManager/Seat0'
278
-
279
- # SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
280
-
281
- # DEFAULTS_PATH = '/usr/share/gconf/ubuntu.default.path'
282
-
283
- # SESSION_MANAGER = 'local/ubun-VirtualBox:@/tmp/.ICE-unix/1539,unix/ubun-VirtualBox:/tmp/.ICE-unix/1539'
284
-
285
- # XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg'
286
-
287
- # UNITY_DEFAULT_PROFILE = 'unity'
288
-
289
- # DESKTOP_SESSION = 'ubuntu'
290
-
291
- # PATH = '/home/ubun/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/ubun/bin:/home/ubun/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ubun/ProgramFiles/android-sdk/tools/bin:/home/ubun/ProgramFiles/android-sdk/platform-tools:/home/ubun/ProgramFiles/android-sdk/tools/bin:/home/ubun/ProgramFiles/android-sdk/platform-tools:/home/ubun/ProgramFiles/android-sdk/tools/bin:/home/ubun/ProgramFiles/android-sdk/platform-tools'
292
-
293
- # ANDROIDAPI = '27'
294
-
295
- # QT_IM_MODULE = 'fcitx'
296
-
297
- # QT_QPA_PLATFORMTHEME = 'appmenu-qt5'
298
-
299
- # XDG_SESSION_TYPE = 'x11'
300
-
301
- # PWD = '/home/ubun'
302
-
303
- # JOB = 'unity-settings-daemon'
304
-
305
- # XMODIFIERS = '@im=fcitx'
306
-
307
- # GNOME_KEYRING_PID = ''
308
-
309
- # LANG = 'ja_JP.UTF-8'
310
-
311
- # GDM_LANG = 'ja'
312
-
313
- # MANDATORY_PATH = '/usr/share/gconf/ubuntu.mandatory.path'
314
-
315
- # ANDROIDNDK = '/home/ubun/.buildozer/android/platform/android-ndk-r19c'
316
-
317
- # COMPIZ_CONFIG_PROFILE = 'ubuntu'
318
-
319
- # IM_CONFIG_PHASE = '1'
320
-
321
- # GDMSESSION = 'ubuntu'
322
-
323
- # ANDROIDKVER = 'r19c'
324
-
325
- # SESSIONTYPE = 'gnome-session'
326
-
327
- # GTK2_MODULES = 'overlay-scrollbar'
328
-
329
- # SHLVL = '1'
330
-
331
- # HOME = '/home/ubun'
332
-
333
- # XDG_SEAT = 'seat0'
334
-
335
- # LANGUAGE = 'ja'
336
-
337
- # GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated'
338
-
339
- # UPSTART_INSTANCE = ''
340
-
341
- # ANDROIDSDK = '/home/ubun/.buildozer/android/platform/android-sdk'
342
-
343
- # UPSTART_EVENTS = 'xsession started'
344
-
345
- # XDG_SESSION_DESKTOP = 'ubuntu'
346
-
347
- # LOGNAME = 'ubun'
348
-
349
- # COMPIZ_BIN_PATH = '/usr/bin/'
350
-
351
- # DBUS_SESSION_BUS_ADDRESS = 'unix:abstract=/tmp/dbus-kvtUxCvHjt'
352
-
353
- # XDG_DATA_DIRS = '/usr/share/ubuntu:/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop'
354
-
355
- # QT4_IM_MODULE = 'fcitx'
356
-
357
- # LESSOPEN = '| /usr/bin/lesspipe %s'
358
-
359
- # INSTANCE = ''
360
-
361
- # UPSTART_JOB = 'unity7'
362
-
363
- # XDG_RUNTIME_DIR = '/run/user/1000'
364
-
365
- # DISPLAY = ':0'
366
-
367
- # NDKAPI = '19'
368
-
369
- # XDG_CURRENT_DESKTOP = 'Unity'
370
-
371
- # GTK_IM_MODULE = 'fcitx'
372
-
373
- # LESSCLOSE = '/usr/bin/lesspipe %s %s'
374
-
375
- # XAUTHORITY = '/home/ubun/.Xauthority'
376
-
377
- # _ = '/usr/local/bin/buildozer'
378
-
379
- # PACKAGES_PATH = '/home/ubun/.buildozer/android/packages'
380
-
381
- # ANDROIDMINAPI = '21'
382
-
383
- #
105
+ export ANDROIDNDK="$HOME/Documents/android-ndk-r17c"
106
+
107
+ export ANDROIDAPI="20"
108
+
109
+ export NDKAPI="17"
110
+
111
+ export ANDROIDKVER="r17c"
112
+
113
+ ```
114
+
115
+ `main.py`のディレクトリに移動し
116
+
117
+ 権限で引っかかったので`sudo buidlozer android debug deploy`で実行
118
+
119
+
120
+
121
+ 前回のエラーを解決し今度は動いたと思ったのですが別のエラーになりました
122
+
123
+ ```
124
+
125
+ :
126
+
127
+ [INFO]: -> running python3 setup.py build_ext -v
128
+
129
+ working: error: command '/usr/bin/ccache' failed with exit status 1 Exception in thread background thread for pid 23538:
130
+
131
+ Traceback (most recent call last):
132
+
133
+
134
+
135
+ :
136
+
137
+
138
+
139
+ File "/home/ubun/.local/lib/python3.8/site-packages/sh.py", line 877, in handle_command_exit_code
140
+
141
+ raise exc
142
+
143
+ sh.ErrorReturnCode_1:
144
+
145
+
146
+
147
+ :
148
+
149
+
150
+
151
+ STDOUT:
152
+
153
+ warning: [options] bootstrap class path not set in conjunction with -source 1.7
154
+
155
+ 1 warning
156
+
157
+ running build_ext
158
+
159
+ building 'jnius' extension
160
+
161
+ /usr/bin/ccache /android-ndk-r17c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -I/home/ubun/ProgramFiles/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Include -DANDROID -D__ANDROID_API__=21 -I/android-ndk-r17c/sysroot/usr/include/arm-linux-androideabi -I/home/ubun/ProgramFiles/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/testapp/include/python3.8 -fPIC -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux -I/home/ubun/ProgramFiles/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/Include -I/home/ubun/ProgramFiles/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build -c jnius/jnius.c -o build/temp.linux-x86_64-3.8/jnius/jnius.o
162
+
163
+ clang: error: no such file or directory: 'jnius/jnius.c'
164
+
165
+ clang: error: no input files
166
+
167
+ error: command '/usr/bin/ccache' failed with exit status 1
168
+
169
+
170
+
171
+
172
+
173
+ STDERR:
174
+
175
+ [INFO]: pyjnius first build failed (as expected)
176
+
177
+ [INFO]: Running cython where appropriate
178
+
179
+ [INFO]: Cythonize jnius/jnius.pyx
180
+
181
+ [INFO]: -> running python3 -m Cython.Build.Cythoni...(and 20 more)
182
+
183
+
184
+
185
+ working: /usr/local/bin/python3: Error while findi...(and 100 more) Exception in thread background thread for pid 23562:
186
+
187
+ Traceback (most recent call last):
188
+
189
+
190
+
191
+ :
192
+
193
+
194
+
195
+ File "/home/ubun/.local/lib/python3.8/site-packages/sh.py", line 877, in handle_command_exit_code
196
+
197
+ raise exc
198
+
199
+ sh.ErrorReturnCode_1:
200
+
201
+ RAN: /usr/local/bin/python3 -m Cython.Build.Cythonize ./jnius/jnius.pyx
202
+
203
+
204
+
205
+ STDOUT:
206
+
207
+ /usr/local/bin/python3: Error while finding module specification for 'Cython.Build.Cythonize' (ModuleNotFoundError: No module named 'Cython')
208
+
209
+
210
+
211
+ STDERR:
212
+
213
+ Traceback (most recent call last):
214
+
215
+
216
+
217
+ :
218
+
219
+
220
+
221
+ File "/home/ubun/.local/lib/python3.8/site-packages/sh.py", line 877, in handle_command_exit_code
222
+
223
+ raise exc
224
+
225
+ sh.ErrorReturnCode_1:
226
+
227
+ RAN: /usr/local/bin/python3 -m Cython.Build.Cythonize ./jnius/jnius.pyx
228
+
229
+
230
+
231
+ STDOUT:
232
+
233
+ /usr/local/bin/python3: Error while finding module specification for 'Cython.Build.Cythonize' (ModuleNotFoundError: No module named 'Cython')
234
+
235
+
236
+
237
+ STDERR:
238
+
239
+ # Command failed: /usr/local/bin/python3.8 -m pythonforandroid.toolchain create --dist_name=testapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/ubun/ProgramFiles/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21
240
+
241
+ :
384
242
 
385
243
  # Buildozer failed to execute the last command
386
244
 
@@ -392,25 +250,9 @@
392
250
 
393
251
  # In case of a bug report, please add a full log with log_level = 2
394
252
 
395
-
396
-
397
- ```
253
+ ```
398
-
399
-
400
-
401
- ---
254
+
402
-
403
-
404
-
405
- **試したこと**
406
-
407
- - sudo で実行
408
-
409
- - NDKのバージョンが読み取れないと指摘されていたのでr19cのNDKに変更して実行
410
-
411
- - APIレベル27(Android8.1)のSDKに変更して実行
412
-
413
- 以上の結果も同じエラーになりました
255
+ 何が原因でエラーになってるかわかりません
414
256
 
415
257
 
416
258