Kivy 시작하기 14.03 (모바일 앱 만들기 3)
사용 버전: Python 3.7.6, Kivy 1.11.1
사용 프로그램: Atom 1.43.0 x64
운영체제: 페도라 31 Workstation x64
이제, Python for android 모듈을 사용할 차례입니다.
우선, 만들어진 apk가 출력될 Apk Output 디렉터리를 만듭니다.

그리고 우리가 사용할 Kivy 코드를 git clone 해서 불러옵니다.
git clone https://github.com/shwoghk14/Kivy_for_Starter.git

명령어는 p4a이며, 사용법은 다음과 같습니다.
p4a apk --private $HOME/code/myapp --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python3,kivy

Apk Output 디렉터리로 이동한 뒤, p4a를 사용합니다.
p4a apk --private \$HOME/Github/Kivy_for_Starter/Start\ 14 --package=org.example.myapp --name "URL Download" --bootstrap=sdl2 --requirements=python3,kivy --version 0.1

해당 명령을 치면, 열심히 recipe를 만듭니다.
그리고 이런 오류를 내보냅니다.

_ctypes라는 모듈을 찾을 수 없다는 말인데요.
설치는 되어있습니다. 다만 얘가 못 찾을 뿐이지요.
cp
/usr/lib64/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so
$HOME/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/Lib
를 해줍니다.

다시 명령어를 실행해줍니다.

열심히 또 만들다 보면, 이런 오류가 나옵니다.

main.py를 자동으로 인식해서 apk 파일을 만드는데요.
우리의 파일은 test.py입니다.
main.py를 추가해볼까요?(최신 버전의 Git은 main.py가 추가되어 있습니다.)

그리고 warning을 수정해줍니다.

sudo dnf install g++를 해줍니다.

sudo dnf install lld로 설치합니다.

기존에 만든 recipe와 dist를 지워줍니다.

p4a clean_all

모든 것이 없어졌기 때문에, _ctypes도 다시 옮겨줍니다.

다시 p4a 명령어를 실행합니다.

완료되면, 긴 영문의 apk가 생성됩니다.

짜잔!
끝.
앱:
https://play.google.com/store/apps/details?id=starlight.jaehwa.one
코드:
https://github.com/shwoghk14/Kivy_for_Starter
사용 프로그램: Atom 1.43.0 x64
운영체제: 페도라 31 Workstation x64
기획: URL 소스 자료를 내 휴대폰에 저장하는 앱.
이제, Python for android 모듈을 사용할 차례입니다.
우선, 만들어진 apk가 출력될 Apk Output 디렉터리를 만듭니다.

그리고 우리가 사용할 Kivy 코드를 git clone 해서 불러옵니다.
git clone https://github.com/shwoghk14/Kivy_for_Starter.git

명령어는 p4a이며, 사용법은 다음과 같습니다.
p4a apk --private $HOME/code/myapp --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python3,kivy

Apk Output 디렉터리로 이동한 뒤, p4a를 사용합니다.
p4a apk --private \$HOME/Github/Kivy_for_Starter/Start\ 14 --package=org.example.myapp --name "URL Download" --bootstrap=sdl2 --requirements=python3,kivy --version 0.1

해당 명령을 치면, 열심히 recipe를 만듭니다.
그리고 이런 오류를 내보냅니다.

_ctypes라는 모듈을 찾을 수 없다는 말인데요.
설치는 되어있습니다. 다만 얘가 못 찾을 뿐이지요.
cp
/usr/lib64/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so
$HOME/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/Lib
를 해줍니다.

다시 명령어를 실행해줍니다.

열심히 또 만들다 보면, 이런 오류가 나옵니다.

main.py를 자동으로 인식해서 apk 파일을 만드는데요.
우리의 파일은 test.py입니다.
main.py를 추가해볼까요?(최신 버전의 Git은 main.py가 추가되어 있습니다.)

그리고 warning을 수정해줍니다.

sudo dnf install g++를 해줍니다.

sudo dnf install lld로 설치합니다.

기존에 만든 recipe와 dist를 지워줍니다.

p4a clean_all

모든 것이 없어졌기 때문에, _ctypes도 다시 옮겨줍니다.

다시 p4a 명령어를 실행합니다.

완료되면, 긴 영문의 apk가 생성됩니다.

짜잔!
끝.
앱:
https://play.google.com/store/apps/details?id=starlight.jaehwa.one
코드:
https://github.com/shwoghk14/Kivy_for_Starter
카테고리: BlackSmith, Kivy
댓글
댓글 쓰기
궁금한 점은 댓글 달아주세요.
Comment if you have any questions.