我无法为 android 构建 buildozer

I Can't build buildozer for android

我正在尝试使用 Kivy 和 Buildozer 创建 APK。我正在做与 http://kivy.org/docs/guide/packaging-android.html 教程中相同的操作,但我有错误,而且我不知道如何修复它们。请帮忙。 这是我的错误日志:

BUILD FAILED
/home/oleg/.buildozer/android/platform/android-sdk-21/tools/ant/build.xml:649: The following error occurred while executing this line:
/home/oleg/.buildozer/android/platform/android-sdk-21/tools/ant/build.xml:655: Execute failed: java.io.IOException: Cannot run program "/home/oleg/.buildozer/android/platform/android-sdk-21/build-tools/19.1.0/aidl": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at java.lang.Runtime.exec(Runtime.java:620)
    at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
    at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
    at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:628)
    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495)
    at com.android.ant.AidlExecTask$AidlProcessor.process(AidlExecTask.java:102)
    at com.android.ant.MultiFilesTask.processFiles(MultiFilesTask.java:131)
    at com.android.ant.AidlExecTask.execute(AidlExecTask.java:203)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.Main.runBuild(Main.java:851)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 48 more

Total time: 1 second
o
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/platform/python-for-android/dist/myapp/private/lib/python2.7/lib-dynload/syslog.so
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/platform/python-for-android/dist/myapp/private/lib/python2.7/config/Setup
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/platform/python-for-android/dist/myapp/private/lib/python2.7/config/config.c
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/platform/python-for-android/dist/myapp/private/lib/python2.7/config/config.c.in
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/platform/python-for-android/dist/myapp/private/lib/python2.7/config/Makefile
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/platform/python-for-android/dist/myapp/private/lib/python2.7/config/Setup.local
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/platform/python-for-android/dist/myapp/private/lib/python2.7/config/Setup.config
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/platform/python-for-android/dist/myapp/private/lib/python2.7/config/install-sh
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/app/sitecustomize.pyo
assets/private.mp3: /home/oleg/Desktop/lol/.buildozer/android/app/main.pyo
Traceback (most recent call last):
  File "build.py", line 508, in <module>
    make_package(args)
  File "build.py", line 357, in make_package
    subprocess.check_call([ANT, arg])
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ant', 'debug']' returned non-zero exit status 1
# Command failed: /usr/bin/python build.py --name 'first app' --version 1.0 --package org.test.myapp --private /home/oleg/Desktop/lol/.buildozer/android/app --sdk 14 --minsdk 8 --orientation landscape debug
# 
# 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

我解决了!我看到了一些说明和一些软件包的特定安装,以便在 Ubuntu 14.04(64 位)上使用它。 这是我的完整步骤:

apt-get install python-pip
pip install --upgrade buildozer

apt-get install python2.7-dev
pip install --upgrade cython

dpkg --add-architecture i386

apt-get update
apt-get install build-essential ccache git lib32z1 libncurses5:i386 libstdc++6:i386 python2.7 openjdk-7-jdk unzip zlib1g-dev zlib1g:i386

apt-get install python-kivy

就我而言,接受的答案没有用,我最终不得不做的是

pip uninstall buildozer
rm -rf ~/.buildozer
pip install buildozer
buildozer android debug

这次buildozer在开始构建工程的时候就得去下载ANT,SDK,NDK 然后我必须按原样更新 SDK here

总结

  1. 运行 buildozer 的 SDK 管理器使用

    ~/.buildozer/android/platform/android-sdk-*/tools/android

    星号是 20 或 21 的地方使用制表符补全来找出

  2. update/install 将工具构建到所需级别(至少 20 个)