我试图通过Kivy构建Android应用程序。首先,我尝试使用代码运行 buildozer android debug :
__version__=="1.0"
from kivy.app import App
from kivy.uix.button import Button
class HelloApp(App):
def build(self):
return Button(text='Hello')
if __name__=='__main__':
HelloApp().run()
当它奏效时,我确实感到高兴。我在手机上成功测试了它。然后,我尝试将从injnius .... 添加到此代码中以开发本机应用程序。这个新代码:
__version__=="1.0"
from kivy.app import App
from kivy.uix.button import Button
from jnius import autoclass
BluetoothApdapter=autoclass('android.bluetooth.BluetoothAdapter') # example...
class HelloApp(App):
def build(self):
return Button(text='Hello')
if __name__=='__main__':
HelloApp().run()
然后我运行了行命令 buildozer android debug 。它没有用。这是log errror:
jnius/jnius_utils.pxi:188:45: Obtaining char* from temporary Python value
/home/mylap/Desktop/Hello2/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running build_ext
building 'jnius' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /root/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -DNDEBUG -DANDROID -mandroid -fomit-frame-pointer --sysroot /root/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm -fPIC -I/home/mylap/Desktop/Hello2/.buildozer/android/platform/python-for-android/build/python-install/include/python2.7 -c jnius/jnius.c -o build/temp.linux-i686-2.7/jnius/jnius.o
jnius/jnius.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^error: command 'arm-linux-androideabi-gcc' failed with exit status 1
然后,我尝试用一些解决方案解决它,例如:
pip install cython=={version: 0.17.1, 0.20, 0.19}
sudo apt-add-repository ppa:cython-dev/master-ppa
sudo apt-get update
sudo apt-get install cython
sudo apt-get install python-pip
sudo pip install --upgrade cython
但是,它仍然无法运作。我正在使用:Unbutun 14(VWM为32位),Python 2.7,Kivy 1.7版。