kivy-Buildozer: packed to android apk
Prerequisite: Java Home
Download openJDK 8 from here.
|
1 install Buildozer
|
If you come with error buildozer debug error "[WARNING]" when i run buildozer andriod debug
, please install lib below
|
链接安卓手机, 开启USB debug模式;
进入 kivy 项目目录
测试项目:https://github.com/sevvalbrt/Todolist
|
手机有什么提示, 记得选择
可能会下一些东西. 等一下就好了
更多参考:
https://cycleuser.gitbooks.io/kivy-guide-chinese/content/15-Kivy-Pack-Android.html
Quick Test
Download a Kivy example
|
As this photo above, it’ll take a while…
The problem is you’ll download a bunch of libs and you’ll fail if one of the packages download fail.
[‘hostpython3’, ‘libffi’, ‘openssl’, ‘sdl2_image’, ‘sdl2_mixer’, ‘sdl2_ttf’, ‘sqlite3’, ‘python3’, ‘sdl2’, ‘setuptools’, ‘six’, ‘pyjnius’, ‘android’, ‘kivy’]
- android-ndk-r19c-linux-x86_64.zip
## 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
I got an error and it says I need to read the error code in full log file…
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
reference: lplj717 2019
It seems like I got a wrong version of jave.
So, I removed the new version and keep the jdk8.
And then, a new error arise:
WARNING: Received a --sdk argument, but this argument is deprecated and does nothing. BUILD FAILURE: No main.py(o) found in your app directory. This file must exist to act as the entry point for you app. If your app is started by a file with a different name, rename it to main.py or add a main.py that loads it.
So… mv Main.py
to main.py
and then:
Could not find tools.jar. Please check that /home/ken/Soft/jre1.8.0_231 contains a valid JDK installation
reference: CUFFS 2017
So, there are some thing wrong with my JAVA environment, I download it from https://adoptopenjdk.net and export them in ~/.bashrc
Success
When the code shows as below, it means everything is down and you can upload apk file from bin to your Android phone:
WARNING: Received a --sdk argument, but this argument is deprecated and does nothing. No setup.py/pyproject.toml used, copying full private data into .apk. Applying Java source code patches... Applying patch: src/patches/SDLActivity.java.patch Warning: failed to apply patch (exit code 1), assuming it is already applied: src/patches/SDLActivity.java.patch ## Android packaging done! ## APK myapp-0.1-armeabi-v7a-debug.apk available in the bin directory
ummmm… I fail to open this app in Huawei p30 pro. But I tried another more simple app and it succeed.
|
Erros
RAN: /bin/tar xf /media/ken/Data/Kivy_env/Kivy2Py3.8.1MD0.104.2.dev0/.buildozer/android/platform/build-armeabi-v7a/packages/cython/0.29.15.tar.gz STDOUT: STDERR: /bin/tar: This does not look like a tar archive gzip: stdin: unexpected end of file /bin/tar: Child returned status 1 /bin/tar: Error is not recoverable: exiting now
cypython file is damaged. Delete .buildozer/android/platform/build-armeabi-v7a/packages/cython
to download it again
|
kivy-Buildozer: packed to android apk
https://karobben.github.io/2021/01/01/Python/kivy-Buildozer/