Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kivy buildozer build error #894

Closed
martinel21 opened this issue May 5, 2019 · 7 comments
Closed

Kivy buildozer build error #894

martinel21 opened this issue May 5, 2019 · 7 comments

Comments

@martinel21
Copy link

martinel21 commented May 5, 2019

I am trying to build for kivy in a VM and when i put the last command i get this error:

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/andrei/Downloads/.buildozer/android/platform/build" --ndk-api=21
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2





here is the full log of the command:





andrei@andrei-VirtualBox:~/Downloads$ sudo buildozer android debug deploy run
# Check configuration tokens
Buildozer is running as root!
This is not recommended, and may lead to problems later.
Are you sure you want to continue [y/n]? y
# Ensure build layout
# Check configuration tokens
# Read available permissions from api-versions.xml
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.0.5 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /usr/local/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-11-openjdk-amd64/bin/keytool
# Install platform
# Run '/usr/bin/python -m pip install -q --user \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'six\' \'enum34; python_version<"3.4"\' \'sh>=1.10; sys_platform!="nt"\''
# Cwd None
# Apache ANT found at /home/andrei/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/andrei/.buildozer/android/platform/android-sdk
# Android NDK found at /home/andrei/.buildozer/android/platform/android-ndk-r17c
# Read available permissions from api-versions.xml
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/andrei/Downloads/.buildozer/android/platform/build" --ndk-api=21'
# Cwd /home/andrei/Downloads/.buildozer/android/platform/python-for-android
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI: 27
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/andrei/Downloads/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1081, in <module>
    main()
  File "/home/andrei/Downloads/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1075, in main
    ToolchainCL()
  File "/home/andrei/Downloads/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 577, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/andrei/Downloads/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 144, in wrapper_func
    user_ndk_api=self.ndk_api)
  File "pythonforandroid/build.py", line 237, in prepare_build_environment
    targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n')
  File "/home/andrei/.local/lib/python2.7/site-packages/sh.py", line 1427, in __call__
    return RunningCommand(cmd, call_args, stdin, stdout, stderr)
  File "/home/andrei/.local/lib/python2.7/site-packages/sh.py", line 774, in __init__
    self.wait()
  File "/home/andrei/.local/lib/python2.7/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/andrei/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/andrei/.buildozer/android/platform/android-sdk/tools/bin/avdmanager list target

  STDOUT:


  STDERR:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
    at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
    at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
    at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
    at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 5 more

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/andrei/Downloads/.buildozer/android/platform/build" --ndk-api=21
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
@vlouvet
Copy link

vlouvet commented May 22, 2019

I am getting this same error, and it appears that it has to do with Buildozer requiring Java version 8, which Ubuntu comes with version 11.

There is more info here https://stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a and here #832

I think the instructions could be expanded to explain how to have two java versions co-exist on an Ubuntu system (if necessary) and how to tell buildozer which version to use exactly

@simon2x
Copy link

simon2x commented May 27, 2019

OS: Ubuntu 18.04

Installing Java version 8 fixed this issue for me.

sudo apt-get install openjdk-8-jdk

I used the following cmd line to interactively change default java version.

sudo update-alternatives --config java

@sfoerster
Copy link

I was able to get buildozer working again with Java 11 on Linux Mint with these tips:
https://stackoverflow.com/questions/53076422/getting-android-sdkmanager-to-run-with-java-11

@AndreMiras
Copy link
Member

This error java.lang.NoClassDefFoundError has indeed to do with the JDK version where Buildozer only supported version 8, refs https://github.com/kivy/python-for-android/blob/v2020.04.29/doc/source/troubleshooting.rst#errors-related-to-java-version
This got updated recently in the master branch (unreleased) via #1135
So either use OpenJDK 8 or pip install the master branch

@ykdevelopers
Copy link

can we upload multiples files in google coolab

@ykdevelopers
Copy link

i also face buildozer problem

1 similar comment
@shanmugam2005
Copy link

i also face buildozer problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants