Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Buildozer doesn't work with java under cygwin

I'm trying to buildozer android debug deploy in my cygwin environment. So far it worked quite well, but upon trying to build, I run into the following error:

$ 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"

What is funny, is that if I do java -version in cygwin it returns

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)

so cygwin does know java. What am I missing here?

EDIT: Ok, I've tried to do the following in the android.py file of buildozer on line 92:

import cygwinreg as _winreg

But that just gave me the following error instead of the _winreg not recognized:

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

EDIT2:

I've managed to angle to this error:

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__

EDIT 3:

I've already set the environment variable JAVA_HOME to my SDK path, so that cannot be the problem. I think it's a problem of winreg not being able to properly import that path.

EDIT 4: Through the help of a nice guy called Gavin Bravery I'm now no longer getting other errors than the java error. Current output on trying to

buildozer android debug deploy

is

# 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"

With a

export JAVA_HOME=$( cygpath "JAVA_HOME" )

I can circumvent the path warning, so its down to the "No suitable Java found." Error. Does anyone have an idea on that?

like image 772
plocks Avatar asked Nov 01 '22 23:11

plocks


1 Answers

Which OS version are you trying to run this on? Occasionally cygwin shows strange behaviour on 32bit OS.

like image 76
Ben Sch Avatar answered Nov 12 '22 09:11

Ben Sch