Error on first Kivy/Buildozer android project

2020-02-02 03:23发布

Trying to run Kivy with buildozer on Ubuntu 16.04, (startup-demo-project pong) I get an error on command

buildozer android debug deploy

After: .... [DEBUG]: BUILD SUCCESSFUL ....

at the end of the build there is an error message:

....
IOError: [Errno 2] No such file or directory: u'/home/std/Dokumente/python  
/Kivy/.buildozer/android/platform/build/dists/myapp/build/outputs  
/apk/myapp-debug.apk'

My installation is according to: http://buildozer.readthedocs.io/en/latest/installation.html for Ubuntu 16.04.

Also buildozer serve does not show anything useful, only:

Directory listing for /

as response to call:

http://localhost:8000

Buildozer console says:

192.168.178.22 - - [15/Apr/2018 21:43:12] "GET / HTTP/1.1" 200 -
192.168.178.22 - - [15/Apr/2018 21:43:12] code 404, message File not found

Annotation: I changed the log_level = 2 for more information, but could not figure out where to find the relevant log file or where to get more information about the error.

1条回答
Luminary・发光体
2楼-- · 2020-02-02 03:56

Problem

IOError: [Errno 2] No such file or directory: u'/home/std/Dokumente/python  /Kivy/.buildozer/android/platform/build/dists/myapp/build/outputs  /apk/myapp-debug.apk'

Solution

Use sudo to change and recompile android.py for Python 2.7. Please do the following at terminal window:

Step 1

Change directory

cd /usr/local/lib/python2.7/dist-packages/buildozer/targets

Step 2

Make backup copies of android.py and android.pyc

sudo cp android.py android-orig.py
sudo cp android.pyc android-orig.pyc

Step 3

Use an editor to make changes to android.py

sudo gedit android.py

Step 4

Insert the following import before import sys

from distutils.version import LooseVersion

Step 5

Add the following codes after line 791 (# XXX found how the apk name is really built from the title). Note: __sdk_dir (double underscore). Please refer to print screens below for details.

    __sdk_dir = self.android_sdk_dir
    build_tools_versions = os.listdir(join(__sdk_dir, 'build-tools'))
    build_tools_versions = sorted(build_tools_versions, key=LooseVersion)
    build_tools_version = build_tools_versions[-1]

    gradle_files = ["build.gradle", "gradle", "gradlew"]
    is_gradle_build = any((
        exists(join(dist_dir, x)) for x in gradle_files)) and build_tools_version >= '25.0'

    if is_gradle_build:

Step 6

Save the changes.

Step 7

Compile android.py

At shell prompt

sudo python -m py_compile a--ndroid.py

or invoke Python Interpreter Interactive Shell

sudo python
>>> import py_compile
>>> py_compile.compile('android.py')

Step 8

At your project folder, run

buildozer android debug

Pictures

Changes Part 1 - from distutils.version import LooseVersion

Img01 - import LooseVersion

Changes Part 2

Img02 - remaining changes

Compile android.py

Img03 - Compile android.py

After Changes @ local Buildozer - App deployed to Acer Android tablet

Img04 @ local Buildozer - App deployed

After Changes @ Buildozer VM - Successful APK

enter image description here

Before Changes @ local Buildozer - IOError: [Errno 2] No such file or directory

Img06 @ local Buildozer - IOError: Errno 2

Before Changes @ Buildozer VM - IOError: [Errno 2] No such file or directory

Img07 @ BuildozerVM - IOError: Errno 2

查看更多
登录 后发表回答