-
Python만으로 어플을 만들어보자 #7 (buildozer error shooting)Programing/python 어플 개발 2022. 4. 23. 14:05반응형
Python으로 어플만들기 7탄
: buildozer android debug deploy run 에러 해결하기
사실 buildozer를 이용해서 apk파일 하나 만드는데 매우 많은 에러가 발생했었습니다.
해결하나 하니 그 다음 에러가 기다리고 있고, 그걸 반복하는 연속이였습니다.
이번엔 제게 발생했던 에러들과 해결했던 방법을 정리해보도록 하겠습니다.
Error(?)1
: error unable to find a match zlib1g-dev
에러라기보다는 그냥 필요한 패키지들이 없다는 알람이 계속 떴습니다.
일단 제가 실행하면서 추가적으로 설치했던 라이브러리, 패키지들을 모두 적어보겠습니다.
(이러면 안좋긴 한데... 그냥 손이 가는대로 pip랑 apt랑 섞어 썼습니다...)
python3 -m pip install --upgrade pip python3 -m pip install --upgrade wheel python3 -m pip install --upgrade cython python3 -m pip install --upgrade virtualenv sudo apt install unzip sudo apt install zlib1g-dev sudo apt -y install openjdk-8-jdk # zlib1g없다고 해서 처음엔 zlib1g를 install 했었는데 안되더라구요... dev로 설치해야함
Error 2
sdkmanager path "/home/'username'/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager" does not exist, sdkmanager is notinstalled
또 에러가 터졌습니다.
sdkmanager path "/home/Lee/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager" does not exist, sdkmanager is notinstalled
이번엔 저 위치에 sdkmanager라는게 없다고 하는군요.
검색결과,
어떤 훌륭하신 분이 먼저 같은 질문을 올려주셨고,
어떤 훌륭하신 분이 해결 방법을 올려주셨습니다.
cd ~/.buildozer/android/platform/android-sdk curl -L -O -C - https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip unzip sdk-tools-linux-4333796.zip
Error 3
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
또 에러가 발생했습니다.
(전체 에러 로그는 '더보기'를 누르면 보실 수 있습니다. - 너무 길어요...)
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
더보기# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Read available permissions from api-versions.xml
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.7 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
# -> found at /usr/bin/git
# Search for Cython (cython)
# -> found at /home/lee_ubuntu/.local/bin/cython
# Search for Java compiler (javac)
# -> found at /usr/lib/jvm/java-13-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
# -> found at /usr/lib/jvm/java-13-openjdk-amd64/bin/keytool
# Install platform
# Run 'git config --get remote.origin.url'
# Cwd /mnt/c/Users/user/Documents/Python Scripts/kivy_appliciation/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv'
# Cwd /mnt/c/Users/user/Documents/Python Scripts/kivy_appliciation/.buildozer/android/platform/python-for-android
* master 227a7658 [origin/master] Merge pull request #2561 from misl6/release-2022.03.13
# Run '/usr/bin/python3 -m pip install -q \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'six\' \'enum34; python_vers
ion<"3.4"\' \'sh>=1.10; sys_platform!="nt"\' \'pep517<0.7.0\' \'toml\''
# Cwd None
# Apache ANT found at /home/lee_ubuntu/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/lee_ubuntu/.buildozer/android/platform/android-sdk
# Recommended android's NDK version by p4a is: 19c
# Android NDK found at /home/lee_ubuntu/.buildozer/android/platform/android-ndk-r19c
# Installing/updating SDK platform tools if necessary
# Run '/home/lee_ubuntu/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager --sdk_root=/home/lee_ubuntu/.b
uildozer/android/platform/android-sdk platform-tools'
# Cwd /home/lee_ubuntu/.buildozer/android/platform/android-sdk
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
# Command failed: /home/lee_ubuntu/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager --sdk_root=/home/le
e_ubuntu/.buildozer/android/platform/android-sdk platform-tools
# ENVIRONMENT:
# SHELL = '/bin/bash'
# WSL_DISTRO_NAME = 'Ubuntu'
# NAME = 'DESKTOP-POAR3EN'
# PWD = '/mnt/c/Users/user/Documents/Python Scripts/kivy_appliciation'
# LOGNAME = 'lee_ubuntu'
# HOME = '/home/lee_ubuntu'
# LANG = 'C.UTF-8'
# WSL_INTEROP = '/run/WSL/9_interop'
# LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=0
0:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.
taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01
;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01
;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sa
r=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:
*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.p
bm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;
35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*
.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;
35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv
=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:
*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=
00;36:*.xspf=00;36:'
# VIRTUAL_ENV = 'C:\\Users\\user\\Documents\\Python Scripts\\kivy_appliciation\\kivy_venv'
# LESSCLOSE = '/usr/bin/lesspipe %s %s'
# TERM = 'xterm-256color'
# LESSOPEN = '| /usr/bin/lesspipe %s'
# USER = 'lee_ubuntu'
# SHLVL = '1'
# PS1 = ('(C:\\Users\\user\\Documents\\Python Scripts\\kivy_appliciation\\kivy_venv) '
'\\[\\e]0;\\u@\\h: '
'\\w\\a\\]${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033
[00m\\]\\$ ')
# WSLENV = ''
# XDG_DATA_DIRS = '/usr/local/share:/usr/share:/var/lib/snapd/desktop'
# PATH = ('/home/lee_ubuntu/.buildozer/android/platform/apache-ant-1.9.4/bin:C:\\Users\\user\\Documents\\Python
'
'Scripts\\kivy_appliciation\\kivy_venv/Scripts:/home/lee_ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbi
n:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Users/user/Documents/Python '
'Scripts/kivy_appliciation/kivy_venv/Scripts:/mnt/c/Program '
'Files/Java/jdk1.8.0_151/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/Sy
stem32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program '
'Files (x86)/Windows Live/Shared:/mnt/c/Program Files/Datasolution/KoreaPlus '
'Statistics/Statistics/25/JRE/bin:/mnt/c/Windows/System32:/mnt/c/Program '
'Files/Git/cmd:/mnt/c/Program Files/MySQL/MySQL Shell '
'8.0/bin/:/mnt/c/Users/user/anaconda3:/mnt/c/Users/user/anaconda3/Library/mingw-w64/bin:/mnt/c/Users/user/anaconda
3/Library/usr/bin:/mnt/c/Users/user/anaconda3/Library/bin:/mnt/c/Users/user/anaconda3/Scripts:/mnt/c/Users/user/App
Data/Local/Programs/Python/Python36/Scripts/:/mnt/c/Users/user/AppData/Local/Programs/Python/Python36/:/mnt/c/Users
/user/AppData/Local/Programs/Python/Python37/Scripts/:/mnt/c/Users/user/AppData/Local/Programs/Python/Python37/:/mn
t/c/Users/user/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/user/AppData/Local/Programs/Microsoft '
'VS '
'Code/bin:/mnt/c/Users/user/AppData/Local/Programs/Python/Python36:/mnt/c/Users/user/AppData/Local/Programs/Python
/Python36/Scripts:/mnt/c/Program '
'Files/JetBrains/PyCharm Community Edition '
'2021.1.3/bin:/snap/bin:/home/lee_ubuntu/.local/bin/')
# HOSTTYPE = 'x86_64'
# OLDPWD = '/mnt/c/Users/user/Documents/Python Scripts/kivy_appliciation/buildozer'
# _ = '/usr/local/bin/buildozer'
#
# 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이번 오류는 해결방법 찾는데 좀 오래걸렸습니다
다들 안드로이드 스튜디오를 활용해서 해결하는 방법을 알려주는데 전 안드로이드 스튜디오를 설치하지 않았으니까 안드로이드 스튜디오 없이 해결하고 싶었거든요ㅠㅠㅠㅠ
Error3 문제의 원인
먼저, 문제의 원인은 JAVA의 버전문제라고 합니다. (참고: https://github.com/kivy/buildozer/issues/1425)
java 버전을 확인해보겠습니다.
$ java -version # 자바 버전 확인 # openjdk version "13.0.7" 2021-04-20
어?? 난 buildozer 공식github에서 권장하는대로 openjdk-13인데?!
더 검색해보니
JAVA 버전이 1.8보다 높은 경우 라이브러리를 못 찾을 수도 있다고 합니다.... 아...
Error3 문제의 해결방법
위의 블로그를 작성하신 분에 따르면, 이 경우 문제를 해결하는 방법은 크게 두가지라고 합니다.
- 자바 1.8로 환경을 변경한다.
- 필요한 lib를 설치해준다.
저는 1번 방법을 사용해보겠습니다.
자바 버전을 변경하는 방법은 이 블로그(https://freedeveloper.tistory.com/347)를 참고하였습니다.
$ sudo update-alternatives --config java [sudo] password for lee_ubuntu: # 비밀번호를 입력해주세요 There are 3 choices for the alternative java (providing /usr/bin/java). # 현재 변경 가능한 java가 3개 더 있네요 Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-13-openjdk-amd64/bin/java 1311 auto mode # 현재 선택되어있는 java입니다. 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode 2 /usr/lib/jvm/java-13-openjdk-amd64/bin/java 1311 manual mode 3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode # 우리의 목표는 3번입니다. Press <enter> to keep the current choice[*], or type selection number: 3 # '3'을 입력하고 엔터를 눌러주세요 update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode
다시 한 번 java 버전을 확인해보면, 1.8로 변경된 것을 확인하실 수 있습니다.
Error 4
fatal error: 'pyconfig.h' file not found
이번엔 아래와 같은 에러가 발생했습니다.
fatal error: 'pyconfig.h' file not found #include "pyconfig.h" ^~~~~~~~~~~~ 1 error generated. make: *** [/mnt/c/Users/user/Documents/Python_Scripts/kivy_appliciation/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/bootstrap_builds/sdl2/obj/local/armeabi-v7a/objs-debug/main/start.o] Error 1 STDERR: # Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch arm64-v8a --arch armeabi-v7a --copy-libs --color=always --storage-dir="/mnt/c/Users/user/Documents/Python_Scripts/kivy_appliciation/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a" --ndk-api=21 --ignore-setup-py --debug
이 경우는 Python developer package가 설치되어있지 않기 때문에 발생한 것으로 보입니다.
(https://github.com/kivy/buildozer/issues/1031#issuecomment-600700197)
python-dev를 추가로 설치해줍니다.
$ sudo apt-get install python3.8-dev
만약 python-dev를 설치했는데도 동일한 에러가 발생한다면, 이미 설치되어있는 pyconfig.h의 위치를 직접 찾아줘야합니다.
$ sudo find / -name pyconfig.h # 아래와 같은 결과를 찾습니다. # /(생략)/include/python3.x/pyconfig.h
/mnt/c/Users/user/Documents/Python_Scripts/kivy_appliciation/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/pyconfig.h /mnt/c/Users/user/Documents/Python_Scripts/kivy_appliciation/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/PC/pyconfig.h /mnt/c/Users/user/Documents/Python_Scripts/kivy_appliciation/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/arm64-v8a__ndk_target_21/python3/android-build/pyconfig.h /mnt/c/Users/user/Documents/Python_Scripts/kivy_appliciation/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/arm64-v8a__ndk_target_21/python3/PC/pyconfig.h /mnt/c/Users/user/Documents/Python_Scripts/kivy_appliciation/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/android-build/pyconfig.h /mnt/c/Users/user/Documents/Python_Scripts/kivy_appliciation/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/PC/pyconfig.h /mnt/c/Users/user/venv/Lib/site-packages/tensorflow/include/external/local_config_python/python_include/pyconfig.h find: ‘/mnt/c/Windows/appcompat/Programs’: Permission denied find: ‘/mnt/c/Windows/CSC/v2.0.6’: Permission denied find: ‘/mnt/c/Windows/InfusedApps’: Permission denied find: ‘/mnt/c/Windows/LiveKernelReports’: Permission denied find: ‘/mnt/c/Windows/Logs/SystemRestore’: Permission denied find: ‘/mnt/c/Windows/Minidump’: Permission denied find: ‘/mnt/c/Windows/ModemLogs’: Permission denied find: ‘/mnt/c/Windows/PLA/Reports’: Permission denied find: ‘/mnt/c/Windows/PLA/Rules’: Permission denied find: ‘/mnt/c/Windows/PLA/Templates’: Permission denied find: ‘/mnt/c/Windows/Prefetch’: Permission denied find: ‘/mnt/c/Windows/Provisioning/Autopilot’: Permission denied find: ‘/mnt/c/Windows/Resources/Themes/aero/VSCache’: Permission denied find: ‘/mnt/c/Windows/security/audit’: Permission denied find: ‘/mnt/c/Windows/security/cap’: Permission denied find: ‘/mnt/c/Windows/ServiceProfiles/LocalService’: Permission denied find: ‘/mnt/c/Windows/ServiceProfiles/NetworkService’: Permission denied find: ‘/mnt/c/Windows/ServiceState’: Permission denied find: ‘/mnt/c/Windows/System32/appmgmt/MACHINE’: Permission denied find: ‘/mnt/c/Windows/System32/appmgmt/S-1-5-18’: Permission denied find: ‘/mnt/c/Windows/System32/Com/dmp’: Permission denied find: ‘/mnt/c/Windows/System32/config’: Permission denied find: ‘/mnt/c/Windows/System32/Configuration’: Permission denied find: ‘/mnt/c/Windows/System32/drivers/DriverData’: Permission denied find: ‘/mnt/c/Windows/System32/DriverState’: Permission denied find: ‘/mnt/c/Windows/System32/FxsTmp’: Permission denied find: ‘/mnt/c/Windows/System32/ias’: Permission denied find: ‘/mnt/c/Windows/System32/LogFiles/WMI’: Permission denied find: ‘/mnt/c/Windows/System32/MsDtc’: Permission denied find: ‘/mnt/c/Windows/System32/networklist’: Permission denied find: ‘/mnt/c/Windows/System32/SleepStudy’: Permission denied find: ‘/mnt/c/Windows/System32/spool/PRINTERS’: Permission denied find: ‘/mnt/c/Windows/System32/spool/SERVERS’: Permission denied find: ‘/mnt/c/Windows/System32/sru’: Permission denied find: ‘/mnt/c/Windows/System32/Tasks’: Permission denied find: ‘/mnt/c/Windows/System32/Tasks_Migrated’: Permission denied find: ‘/mnt/c/Windows/System32/wbem/MOF’: Permission denied find: ‘/mnt/c/Windows/System32/WDI’: Permission denied find: ‘/mnt/c/Windows/SystemTemp’: Permission denied find: ‘/mnt/c/Windows/SysWOW64/Com/dmp’: Permission denied find: ‘/mnt/c/Windows/SysWOW64/config’: Permission denied find: ‘/mnt/c/Windows/SysWOW64/Configuration’: Permission denied find: ‘/mnt/c/Windows/SysWOW64/FxsTmp’: Permission denied find: ‘/mnt/c/Windows/SysWOW64/Msdtc’: Permission denied find: ‘/mnt/c/Windows/SysWOW64/networklist’: Permission denied find: ‘/mnt/c/Windows/SysWOW64/sru’: Permission denied find: ‘/mnt/c/Windows/SysWOW64/Tasks’: Permission denied find: ‘/mnt/c/Windows/Temp’: Permission denied /usr/include/python3.8/pyconfig.h /usr/include/python2.7/pyconfig.h /usr/include/x86_64-linux-gnu/python3.8/pyconfig.h /usr/include/x86_64-linux-gnu/python2.7/pyconfig.h
$ python3 # Python 3.8.10 (default, Mar 15 2022, 12:22:08) >>> quit() $ python3.8-config --includes --libs # -I/usr/include/python3.8 -I/usr/include/python3.8 # -lcrypt -lpthread -ldl -lutil -lm -lm $ vim ~/.bashrc
포기... blue screen...
$ buildozer android debug deploy run
잘 돌아가길래 이제 에러 다 잡았다 싶었는데...
거의 20분 정도 돌아가다가 블루스크린이 뜹니다.....
대체 어느 부분에서 에러가 발생하는 건지 핸드폰으로 영상녹화라도 해야하나 싶습니다. ㅜㅜ
혹시 이런 에러 어떻게 해결해야 하는지 아시는 분은 댓글 달아주세요...ㅜㅜ
저는 그럼 그때까지 다른 방안을 찾아봐야 할 것 같습니다ㅠㅠㅠㅠ반응형'Programing > python 어플 개발' 카테고리의 다른 글
kivy를 활용한 어플 만들기 (Clock Object 사용해보기) (0) 2022.04.28 Python만으로 어플을 만들어보자 #8 (feat. 구름IDE, goorm IDE) (5) 2022.04.26 Python만으로 어플을 만들어보자 #6 (Create a package for Android) (1) 2022.04.21 Python만으로 어플을 만들어보자 #5 (A SimplePaint App #2) (1) 2022.04.20 Python만으로 어플을 만들어보자 #4 (A SimplePaint App #1) (0) 2022.04.19