在kivy-example上的Buildozer无法构建apk

时间:2017-04-18 16:04:47

标签: android python kivy buildozer

我已经安装了kivy(在debian jessie / python 2.7上),示例工作正常,

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y build-essential ccache git zlib1g-dev python2.7 python2.7-dev 
sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 
sudo pip install colorama appdirs sh jinja2 six
sudo pip install --upgrade colorama
sudo apt-get install pkg-config autoconf automake libtool
sudo apt-get install software-properties-common
sudo apt-get install cython  #installs 0.21.1
sudo add-apt-repository ppa:kivy-team/kivy
sudo apt-get update
sudo apt-get install python-kivy python-kivy-examples  #installs 1.8.0
sudo chmod -R 777 /usr/share/kivi-examples/  #install made it Read-Only Root
sudo pip install --upgrade buildozer  #installs 0.32
sudo easy_install buildozer  #just in case?
sudo pip install python-for-android  #0.4?
java -version #reports 1.8.0_121  

但是当我尝试构建任何kivy示例时,它会出错。我在.spec文件中设置了log_level = 2,但我在控制台输出中没有看到任何可能出现问题的内容

/usr/share/kivy-examples/demo/touchtracer$ buildozer init
...
/usr/share/kivy-examples/demo/touchtracer$ buildozer -v android debug
/usr/share/kivy-examples/demo/touchtracer$ buildozer -v android_new debug
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/android/utils/ILogger
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at     sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at     sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.android.utils.ILogger
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
# Command failed: /home/guest/.buildozer/android/platform/android-sdk-20/tools/android list sdk -u -e
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error

此外,在我尝试构建的某个时刻,每次运行buildozer时都会下载android sdk,但现在停止了..或者至少它不再是那个点了。

有可能升级到python 3然后安装python3-kivy会解决这个问题吗?我注意到我当前的安装没有抓住最新的(kivy 1.9.1 / android sdk 21)

[更新#1]我安装了较新版本的buildozer(.33dev),cython(25.2)和kivy(1.9.2.dev0)

cd ~
git clone https://github.com/kivy/buildozer.git
cd buildozer
sudo python setup.py install
cd ..
sudo pip install Cython==0.25.2  #kivy 1.9.2.dev0 required Cython >= 0.23
git clone https://github.com/kivy/kivy
cd kivy
sudo python setup.py install

并更新了.spec文件:

requirements = python2,kivy==master
android.sdk = 24

但仍然没有运气。我能找到的另一件事就是将java8降级为java7。 buildoze不适用于8吗? Buildozer command failed

[更新#2]我卸载了Java8(https://askubuntu.com/questions/84483/how-to-completely-uninstall-java)并安装了Java 1.7.0_80,但我得到了同样的错误

sudo apt-get install oracle-java7-installer
java -version
sudo apt-get install oracle-java7-set-default
sudo update-alternatives --config java

1 个答案:

答案 0 :(得分:-1)

BuilDozer到现在已过时。算了吧。我按照这里的要求坚持使用:Buildozer gives error upon building Pong app of Kivy framework for android publishing

尝试Python for AndroidQPython