目的
Ubuntuでbuildozerを使いPythonプログラムをデバッグしapk化すること。
経緯
- buildozerをインストール
- buildozer.spec 編集
buildozer android debug logcat
コマンドを実行
実行結果
~$ buildozer android debug logcat : import imp [WARNING]: Unable to read the NDK version from the given directory /home/ubun/.buildozer/android/platform/android-ndk-r19c. [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/. [WARNING]: ndk_platform doesn't exist: /home/ubun/.buildozer/android/platform/android-ndk-r19c/platforms/android-21/arch-arm [WARNING]: Could not find toolchain subdirectory! [WARNING]: Could not find any toolchain for arm-linux-androideabi! Traceback (most recent call last): : File "/home/ubun/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 408, in prepare_build_environment self.toolchain_version = toolchain_version UnboundLocalError: local variable 'toolchain_version' referenced before assignment # 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 :
試したこと
- sudo で実行
- NDKのバージョンが読み取れないと指摘されていたのでr19cのNDKに変更して実行
- APIレベル27(Android8.1)のSDKに変更して実行
以上の結果も同じエラーになりました。
- SDKのAPIレベルを20に変更
- NDKをr17cに変更
- main.pyと同じディレクトリにSDK,NDK,specを移動
buildozer.spec
の設定
android.ndk_path=/android-ndk-r17c android.sdk_path=/android-sdk
bashrc
の設定(参考)
# python for android export ANDROIDSDK="$HOME/ProgramFiles/android-sdk/tools/bin" export ANDROIDNDK="$HOME/ProgramFiles/android-ndk-r17c" export ANDROIDAPI="20" export NDKAPI="17" export ANDROIDKVER="r17c"
main.py
のディレクトリに移動し
権限で引っかかったのでsudo buidlozer android debug deploy
で実行
前回のエラーを解決し今度は動いたと思ったのですが別のエラーになりました
: [INFO]: -> running python3 setup.py build_ext -v working: error: command '/usr/bin/ccache' failed with exit status 1 Exception in thread background thread for pid 23538: Traceback (most recent call last): : File "/home/ubun/.local/lib/python3.8/site-packages/sh.py", line 877, in handle_command_exit_code raise exc sh.ErrorReturnCode_1: : STDOUT: warning: [options] bootstrap class path not set in conjunction with -source 1.7 1 warning running build_ext building 'jnius' extension /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 clang: error: no such file or directory: 'jnius/jnius.c' clang: error: no input files error: command '/usr/bin/ccache' failed with exit status 1 STDERR: [INFO]: pyjnius first build failed (as expected) [INFO]: Running cython where appropriate [INFO]: Cythonize jnius/jnius.pyx [INFO]: -> running python3 -m Cython.Build.Cythoni...(and 20 more) working: /usr/local/bin/python3: Error while findi...(and 100 more) Exception in thread background thread for pid 23562: Traceback (most recent call last): : File "/home/ubun/.local/lib/python3.8/site-packages/sh.py", line 877, in handle_command_exit_code raise exc sh.ErrorReturnCode_1: RAN: /usr/local/bin/python3 -m Cython.Build.Cythonize ./jnius/jnius.pyx STDOUT: /usr/local/bin/python3: Error while finding module specification for 'Cython.Build.Cythonize' (ModuleNotFoundError: No module named 'Cython') STDERR: Traceback (most recent call last): : File "/home/ubun/.local/lib/python3.8/site-packages/sh.py", line 877, in handle_command_exit_code raise exc sh.ErrorReturnCode_1: RAN: /usr/local/bin/python3 -m Cython.Build.Cythonize ./jnius/jnius.pyx STDOUT: /usr/local/bin/python3: Error while finding module specification for 'Cython.Build.Cythonize' (ModuleNotFoundError: No module named 'Cython') STDERR: # 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 : # Buildozer failed to execute the last command # The error might be hidden in the log above this error # Please read the full log, and search for it before # raising an issue with buildozer itself. # In case of a bug report, please add a full log with log_level = 2
何が原因でエラーになってるかわかりません。
詳しい方アドバイスお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。