简体   繁体   中英

Kivy to Android apk using Buildozer on Ubuntu not work

I try to build my APK file for Android using Buildozer 1.2.1.dev0 on Ubuntu 19.04, but I get this error: Build failed: Requested API target 27 is not available, install it with the SDK android tool.

I use this command lign: moha@moha-ubuntu:~/PracticePython$ buildozer android debug deploy run

this is my error in terminal:

    [INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI: 27
[INFO]:    Available Android APIs are ()
[ERROR]:   Build failed: Requested API target 27 is not available, install it with the SDK android tool.
# 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/moha/PracticePython/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21
# ENVIRONMENT:
#     SHELL = '/bin/bash'
#     SESSION_MANAGER = 'local/moha-ubuntu:@/tmp/.ICE-unix/1577,unix/moha-ubuntu:/tmp/.ICE-unix/1577'
#     COLORTERM = 'truecolor'
#     XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/etc/xdg'
#     XDG_MENU_PREFIX = 'gnome-'
#     GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated'
#     GTK_IM_MODULE = 'ibus'
#     QT4_IM_MODULE = 'ibus'
#     LC_ADDRESS = 'ar_MA.UTF-8'
#     GNOME_SHELL_SESSION_MODE = 'ubuntu'
#     LC_NAME = 'ar_MA.UTF-8'
#     SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
#     XMODIFIERS = '@im=ibus'
#     DESKTOP_SESSION = 'ubuntu'
#     LC_MONETARY = 'ar_MA.UTF-8'
#     SSH_AGENT_PID = '1521'
#     GTK_MODULES = 'gail:atk-bridge'
#     PWD = '/home/moha/PracticePython'
#     LOGNAME = 'moha'
#     XDG_SESSION_DESKTOP = 'ubuntu'
#     XDG_SESSION_TYPE = 'x11'
#     GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1'
#     XAUTHORITY = '/run/user/1000/gdm/Xauthority'
#     GJS_DEBUG_TOPICS = 'JS ERROR;JS LOG'
#     WINDOWPATH = '2'
#     HOME = '/home/moha'
#     USERNAME = 'moha'
#     IM_CONFIG_PHASE = '1'
#     LC_PAPER = 'ar_MA.UTF-8'
#     LANG = 'en_US.UTF-8'
#     LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
#     XDG_CURRENT_DESKTOP = 'ubuntu:GNOME'
#     VTE_VERSION = '5802'
#     GNOME_TERMINAL_SCREEN = '/org/gnome/Terminal/screen/ad8ac185_b119_4003_a772_aa7e5df632da'
#     INVOCATION_ID = '7da8261caff84895afc09a16646aa4f1'
#     MANAGERPID = '1409'
#     CLUTTER_IM_MODULE = 'ibus'
#     GJS_DEBUG_OUTPUT = 'stderr'
#     LESSCLOSE = '/usr/bin/lesspipe %s %s'
#     XDG_SESSION_CLASS = 'user'
#     TERM = 'xterm-256color'
#     LC_IDENTIFICATION = 'ar_MA.UTF-8'
#     LESSOPEN = '| /usr/bin/lesspipe %s'
#     USER = 'moha'
#     GNOME_TERMINAL_SERVICE = ':1.104'
#     DISPLAY = ':1'
#     SHLVL = '1'
#     LC_TELEPHONE = 'ar_MA.UTF-8'
#     QT_IM_MODULE = 'ibus'
#     LC_MEASUREMENT = 'ar_MA.UTF-8'
#     XDG_RUNTIME_DIR = '/run/user/1000'
#     LC_TIME = 'ar_MA.UTF-8'
#     JOURNAL_STREAM = '9:30571'
#     XDG_DATA_DIRS = '/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop'
#     PATH = '/home/moha/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/moha/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'
#     GDMSESSION = 'ubuntu'
#     DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
#     LC_NUMERIC = 'ar_MA.UTF-8'
#     _ = '/usr/local/bin/buildozer'
#     OLDPWD = '/home/moha'
#     PACKAGES_PATH = '/home/moha/.buildozer/android/packages'
#     ANDROIDSDK = '/home/moha/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/moha/.buildozer/android/platform/android-ndk-r19c'
#     ANDROIDAPI = '27'
#     ANDROIDMINAPI = '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

I know this is an old thread but I had the same issue. I fixed it by

rm -rf ~/.buildozer

if it exists and also

rm -rf <your project folder>/.buildozer

Then run buildozer again:

buildozer -v android debug

You will be prompted to agree to licences a few times. You need to type 'y' not just hit space or enter.

After doing this all should work as expected. It did for me anyway.

Hello and welcome to StackOverflow.

The error message indicates that you've not get any Android SDKs installed, and that you'll need to install the SDK for Android 27 to be able to build your app.

There should be plenty of guides for how to do this on Google; here's one example (different Ubuntu version but likely similar steps): https://linoxide.com/ubuntu-how-to/install-android-sdk-manager-linux-ubuntu-16-04/

I managed to make progress with this by un-commenting and changing the API version in buildozer.spec

# (int) Target Android API, should be as high as possible.
android.api = 32

Now buildozer -v android debug does ask for my confirmation.

Now I am getting Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema , but this is a new story

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM