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

Buildozer Error #874

Closed
spartero opened this issue Apr 6, 2019 · 6 comments
Closed

Buildozer Error #874

spartero opened this issue Apr 6, 2019 · 6 comments

Comments

@spartero
Copy link

spartero commented Apr 6, 2019

I am testing the operation of the packaging of python applications for android. I have taken a simple example of kyvi and I am trying to create the apk file, for android.
I have not modified the file "buildozer.spec", I follow the steps "buildozer -v android debug" and I get an error. I have been modifying parameters of the file and it always gives an error. I have seen that automake, autoconf and libltdl-dev have to be installed. which I have installed but still giving error.

Anyone can help me

  • buildozer 0.39
  • python 3.6
  • ubuntu 18.04
File: main.py

import kivy
kivy.require('1.9.0')

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout

class Contenedor_01(BoxLayout):
	None
	
class MainApp(App):
	title = "Hola Mundo"
	def build(self):
		return Contenedor_01()
		
if __name__ == '__main__':
	MainApp().run()
File: main.kv

<Contenedor_01>:
    Button:
        text: 'Hola'
    Button:
        text: 'Mundo'
File: buildozer.spec

[app]

title = My Application
package.name = myapp
package.domain = org.test
source.dir = .
source.include_exts = py,png,jpg,kv,atlas
version = 0.1
requirements = python3,kivy
orientation = portrait

# OSX Specific
osx.python_version = 3
osx.kivy_version = 1.9.1


# Android specific
fullscreen = 0
android.arch = armeabi-v7a

# iOS specific

ios.kivy_ios_url = https://github.com/kivy/kivy-ios
ios.kivy_ios_branch = master
ios.ios_deploy_url = https://github.com/phonegap/ios-deploy
ios.ios_deploy_branch = 1.7.0

[buildozer]

log_level = 2
warn_on_root = 1

log

ubuntu@android:~/k$ buildozer -v android debug 
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# 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/python3 -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/ubuntu/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/ubuntu/.buildozer/android/platform/android-sdk
# Android NDK found at /home/ubuntu/.buildozer/android/platform/android-ndk-r17c
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/ubuntu/k/.buildozer/android/platform/build" --ndk-api=21'
# Cwd /home/ubuntu/k/.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/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/k/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1081, in <module>
    main()
  File "/home/ubuntu/k/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1075, in main
    ToolchainCL()
  File "/home/ubuntu/k/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 577, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/ubuntu/k/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 144, in wrapper_func
    user_ndk_api=self.ndk_api)
  File "/home/ubuntu/k/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 237, in prepare_build_environment
    targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n')
  File "/home/ubuntu/.local/lib/python3.6/site-packages/sh.py", line 1427, in __call__
    return RunningCommand(cmd, call_args, stdin, stdout, stderr)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/sh.py", line 774, in __init__
    self.wait()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/ubuntu/.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:190)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 5 more

# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/ubuntu/k/.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

@tshirtman
Copy link
Member

Which values do you have for these? I know these ones work for me, i would advise trying the same.

android.api = 26
android.minapi = 21
android.sdk = 21
android.ndk = 17c
android.ndk_api = 21

@spartero
Copy link
Author

spartero commented Apr 6, 2019

I have added your values.

android.api = 26
android.minapi = 21
android.sdk = 21
android.ndk = 17c
android.ndk_api = 21

And it keeps giving error

I realized that when I run the help, I get this error at the end of the console, I do not know if it's interesting

ubuntu@android:~/k$ buildozer help
# Check configuration tokens
Usage:
    buildozer [--profile <name>] [--verbose] [target] <command>...
    buildozer --version

Available targets:
  android            Android target, based on python-for-android project (old toolchain)

Global commands (without target):
  distclean          Clean the whole Buildozer environment.
  help               Show the Buildozer help.
  init               Create a initial buildozer.spec in the current directory
  serve              Serve the bin directory via SimpleHTTPServer
  setdefault         Set the default command to run when no arguments are given
  version            Show the Buildozer version

Target commands:
  clean      Clean the target environment
  update     Update the target dependencies
  debug      Build the application in debug mode
  release    Build the application in release mode
  deploy     Deploy the application on the device
  run        Run the application on the device
  serve      Serve the bin directory via SimpleHTTPServer
Traceback (most recent call last):
  File "/usr/local/bin/buildozer", line 11, in <module>
    load_entry_point('buildozer', 'console_scripts', 'buildozer')()
  File "/usr/local/lib/python3.6/dist-packages/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/usr/local/lib/python3.6/dist-packages/buildozer/__init__.py", line 1034, in run_command
    getattr(self, cmd)(*args)
  File "/usr/local/lib/python3.6/dist-packages/buildozer/__init__.py", line 1095, in cmd_help
    self.usage()
  File "/usr/local/lib/python3.6/dist-packages/buildozer/__init__.py", line 976, in usage
    mt = m.get_target(self)
  File "/usr/local/lib/python3.6/dist-packages/buildozer/targets/android.py", line 1228, in get_target
    return TargetAndroid(buildozer)
  File "/usr/local/lib/python3.6/dist-packages/buildozer/targets/android.py", line 59, in __init__
    self._build_dir = join(self.buildozer.platform_dir, 'build')
  File "/usr/local/lib/python3.6/dist-packages/buildozer/__init__.py", line 878, in platform_dir
    return join(self.buildozer_dir, self.targetname, 'platform')
  File "/usr/lib/python3.6/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.6/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

@AndreMiras
Copy link
Member

For the buildozer help that's failing, I would recommend to install buildozer from master.

pip install --upgrade --user https://github.com/kivy/buildozer/archive/4183428.zip

As for the first error you shared my bet would be with the openjdk version. Make sure you're on openjdk-8-jdk

@spartero
Copy link
Author

spartero commented Apr 6, 2019

I have installed buidozer with the command:

pip install --upgrade --user https://github.com/kivy/buildozer/archive/4183428.zip

I changed the openjdk version from 11 to 8. Now I get an error:

Error: Could not create the Java Virtual Machine.

ubuntu@android:~/Tarifa$ buildozer -v android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# 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-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Install platform
# Run '/usr/bin/python3 -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/ubuntu/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/ubuntu/.buildozer/android/platform/android-sdk
# Android NDK found at /home/ubuntu/.buildozer/android/platform/android-ndk-r17c
# Installing/updating SDK platform tools if necessary
# Run '/home/ubuntu/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager tools platform-tools'
# Cwd /home/ubuntu/.buildozer/android/platform/android-sdk
Unrecognized option: --add-modules
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
# Command failed: /home/ubuntu/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager tools platform-tools
# ENVIRONMENT:
#     LS_COLORS = ''
#     LESSCLOSE = '/usr/bin/lesspipe %s %s'
#     LANG = 'en_US.UTF-8'
#     OLDPWD = '/home/ubuntu'
#     INVOCATION_ID = 'd8400b5a6ffa414cae742bef7cca1030'
#     XDG_SESSION_ID = '3'
#     HUSHLOGIN = 'FALSE'
#     USER = 'ubuntu'
#     PWD = '/home/ubuntu/Tarifa'
#     HOME = '/home/ubuntu'
#     JOURNAL_STREAM = '9:113707'
#     MAIL = '/var/mail/ubuntu'
#     SHELL = '/bin/bash'
#     TERM = 'vt220'
#     SHLVL = '1'
#     LOGNAME = 'ubuntu'
#     XDG_RUNTIME_DIR = '/run/user/1000'
#     PATH = '/home/ubuntu/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'
#     LESSOPEN = '| /usr/bin/lesspipe %s'
#     _ = '/usr/local/bin/buildozer'
# 
# 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

@spartero
Copy link
Author

spartero commented Apr 7, 2019

I returned to make a clean installation of the whole system (I use lxc), install openjdk8. And by magic it works.
We would have to add that we have to install more dependencies:
lld pkg-config zip

@spartero spartero closed this as completed Apr 7, 2019
@AndreMiras
Copy link
Member

Thanks for keeping us updated with this

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

3 participants