5

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?

plocks
  • 561
  • 8
  • 25
  • 1
    Please leave a descriptive comment why you downvote, at least. Then I would try to improve the question. Thank you. – plocks May 26 '14 at 03:44
  • Are you using the 32- or 64-bit version of cygwin? The registry is partitioned in two sections in 64-bit windows -- maybe that's the reason openkey is failing? – matiash Jun 06 '14 at 02:06
  • @matiash I'm going to look into it. – plocks Jun 06 '14 at 03:45
  • @matiash I looked into it and I'm using the 64bit version. Do you think the 32 bit version could help? – plocks Jun 06 '14 at 06:16
  • @matiash I've tested through everything like above with the 32 bit version. Sadly that didn't help. Same error(s), same result :( – plocks Jun 06 '14 at 07:24
  • 1
    Sorry, from past experience with other tools I thought it might be related. However, your last error seems more tractable :) Did you take a look at http://stackoverflow.com/questions/3052743/android-create-call-fails-in-windows-7-missing-jdk ? – matiash Jun 06 '14 at 15:32
  • @matiash thanks for the tipp. I'll look into it ASAP. – plocks Jun 06 '14 at 17:25
  • @matiash Thanks for the link but I think that is also not the case, since you see that in the output I've provided it clearly finds the x86 verison of java "C:\Program Files (x86)\Java\jdk1.7.0_10/bin/javac.exe". Thanks anyways. – plocks Jun 10 '14 at 13:54

2 Answers2

2

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

Ben Sch
  • 2,909
  • 4
  • 20
  • 23
  • sth like http://stackoverflow.com/questions/13545351/cd1-and-variables-with-spaces-cygwin explains about spaces in path? – mico Jun 10 '14 at 19:33
0

Are you pointing to java jre or jdk? I think you point to jre. Normally those more developed apps based on java need the jdk version.

Look: What is the difference between JDK and JRE?

Community
  • 1
  • 1
mico
  • 12,730
  • 12
  • 59
  • 99
  • As you can see in the output I have provided "C:\Program Files (x86)\Java\jdk1.7.0_10/bin/javac.exe" it does actually point to JDK. – plocks Jun 10 '14 at 13:45
  • Does the path / java_home have plain javac.exe or the bin/ only? So is the jdk correctly set in environment variables? Or did the another answer somehow solve the problem? How? – mico Jun 10 '14 at 21:02
  • 1
    Its javac, but that wasn't the problem. I remembered that I had set up a cygwin 64 on another computer. I went through all of it again and somehow the problem is not present anymore?! – plocks Jun 11 '14 at 09:49