我正在尝试buildozer android debug deploy
在我的cygwin环境中。到目前为止它工作得很好,但是在尝试构建时,我遇到了以下错误:
$ buildozer android debug deploy
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/buildozer-0.15_dev-py2.7.egg/buildozer/targets/android.py", line 92, in check_requirements
self._set_win32_java_home()
File "/usr/lib/python2.7/site-packages/buildozer-0.15_dev-py2.7.egg/buildozer/targets/android.py", line 186, in _set_win32_java_home
import _winreg
ImportError: No module named _winreg
# Install platform
# Apache ANT found at /home/Data/.buildozer/android/platform/apache-ant-1.8.4
# Android SDK found at /home/Data/.buildozer/android/platform/android-sdk-21
# Android NDK found at /home/Data/.buildozer/android/platform/android-ndk-r9c
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
# Android packages installation done.
# Check application requirements
# Check garden requirements
# Compile platform
# Command failed: ./distribute.sh -m "kivy" -d "first_kivy_test"
有趣的是,如果我java -version
在 cygwin 中这样做,它会返回
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
所以cygwin确实知道java。我在这里想念什么?
编辑:好的,我尝试在第 92 行的 buildozer 的 android.py 文件中执行以下操作:
import cygwinreg as _winreg
但这只是给了我以下错误,而不是 _winreg 无法识别:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/buildozer-0.15_dev-py2.7.egg/buildozer/targets/android.py", line 92, in check_requirements
self._set_win32_java_home()
File "/usr/lib/python2.7/site-packages/buildozer-0.15_dev-py2.7.egg/buildozer/targets/android.py", line 191, in _set_win32_java_home
self.buildozer.environ['JAVA_HOME'] = java_home
File "/usr/lib/python2.7/site-packages/cygwinreg-1.0-py2.7.egg/cygwinreg/__init__.py", line 146, in __exit__
self.Close()
NameError: global name 'self' is not defined
编辑2:
我设法解决了这个错误:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/buildozer-0.15_dev-py2.7.egg/buildozer/targets/android.py", line 92, in check_requirements
self._set_win32_java_home()
File "/usr/lib/python2.7/site-packages/buildozer-0.15_dev-py2.7.egg/buildozer/targets/android.py", line 187, in _set_win32_java_home
with _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\JavaSoft\Java Development Kit") as jdk: #@UndefinedVariable
AttributeError: __exit__
编辑 3:
我已经将环境变量 JAVA_HOME 设置为我的 SDK 路径,所以这不是问题。我认为这是 winreg 无法正确导入该路径的问题。
编辑 4:通过一个名叫 Gavin Bravery 的好人的帮助,我现在不再遇到除了 java 错误之外的其他错误。尝试时的当前输出
buildozer android debug deploy
是
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
cygwin warning:
MS-DOS style path detected: C:\Program Files (x86)\Java\jdk1.7.0_10/bin/javac.exe
Preferred POSIX equivalent is: /cygdrive/c/Program Files (x86)/Java/jdk1.7.0_10/bin/javac.exe
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
# Install platform
# Apache ANT found at /home/Data/.buildozer/android/platform/apache-ant-1.8.4
# Android SDK found at /home/Data/.buildozer/android/platform/android-sdk-21
# Android NDK found at /home/Data/.buildozer/android/platform/android-ndk-r9c
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
# Android packages installation done.
# Check application requirements
# Check garden requirements
# Compile platform
# Command failed: ./distribute.sh -m "kivy" -d "kivytest"
带一个
export JAVA_HOME=$( cygpath "JAVA_HOME" )
我可以绕过路径警告,所以它归结为“没有找到合适的 Java”。错误。有人对此有想法吗?