I want to compile .py to .apk on Windows 10. I installed ubuntu and buildozer and this error appers when I want to compile file.
sdkmanager path “/home/lukasmatrix/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager” does not exist, sdkmanager is notinstalled
LOGS:
Check configuration tokens
Ensure build layout
Create directory /mnt/c/Users/lukas/Kivy21/lol/venv/.buildozer
Create directory /mnt/c/Users/lukas/Kivy21/lol/venv/bin
Create directory /mnt/c/Users/lukas/Kivy21/lol/venv/.buildozer/applibs
Create directory /mnt/c/Users/lukas/Kivy21/lol/venv/.buildozer/android/platform
Create directory /mnt/c/Users/lukas/Kivy21/lol/venv/.buildozer/android/app
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 'git clone -b master --single-branch https://github.com/kivy/python-for-android.git python-for-
android'
Cwd /mnt/c/Users/lukas/Kivy21/lol/venv/.buildozer/android/platform
Cloning into 'python-for-android'...
Checking out files: 100% (568/568), done.
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"' 'pep517' 'pytoml' 'virtualenv''
Cwd None
Apache ANT found at /home/lukasmatrix/.buildozer/android/platform/apache-ant-1.9.4
Android SDK found at /home/lukasmatrix/.buildozer/android/platform/android-sdk
Recommended android's NDK version by p4a is: 17c
Android NDK found at /home/lukasmatrix/.buildozer/android/platform/android-ndk-r17c
Installing/updating SDK platform tools if necessary
Check configuration tokens
# sdkmanager path "/home/lukasmatrix/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager" does not exist, sdkmanager is notinstalled
Step 2:
Logs after reinstalling buildozer
# Check configuration tokens
# 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 'git config --get remote.origin.url'
# Cwd /mnt/c/Users/lukas/Kivy21/lol/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv'
# Cwd /mnt/c/Users/lukas/Kivy21/lol/.buildozer/android/platform/python-for-android
* master dd69749f [origin/master] Merge pull request #1955 from kivy/release-2019.08.09
# 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"' 'pep517' 'pytoml' 'virtualenv''
# Cwd None
# Apache ANT found at /home/lukasmatrix/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/lukasmatrix/.buildozer/android/platform/android-sdk
# Recommended android's NDK version by p4a is: 17c
# Android NDK found at /home/lukasmatrix/.buildozer/android/platform/android-ndk-r17c
# Installing/updating SDK platform tools if necessary
# Run '/home/lukasmatrix/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager tools platform-tools'
# Cwd /home/lukasmatrix/.buildozer/android/platform/android-sdk
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.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
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: /home/lukasmatrix/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager tools platform-tools
Step 3:
I installed jdk 8 instead of jdk11
Logs:
# 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 'git config --get remote.origin.url'
# Cwd /mnt/c/Users/lukas/Kivy21/lol/venv/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv'
# Cwd /mnt/c/Users/lukas/Kivy21/lol/venv/.buildozer/android/platform/python-for-android
* master dd69749f [origin/master] Merge pull request #1955 from kivy/release-2019.08.09
# 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"' 'pep517' 'pytoml' 'virtualenv''
# Cwd None
# Apache ANT found at /home/lukasmatrix/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/lukasmatrix/.buildozer/android/platform/android-sdk
# Recommended android's NDK version by p4a is: 17c
# Android NDK found at /home/lukasmatrix/.buildozer/android/platform/android-ndk-r17c
# 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="/mnt/c/Users/lukas/Kivy21/lol/venv/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21'
# Cwd /mnt/c/Users/lukas/Kivy21/lol/venv/.buildozer/android/platform/python-for-android
[ERROR]: Build failed: python-for-android no longer supports running under Python 2. Either upgrade to Python 3.4 or higher (recommended), or revert to python-for-android 2019.07.08. Note that you *can* still target Python 2 on Android by including python2 in your requirements.
Step 4:
Changed default python 2.7 to 3.7.5
Traceback (most recent call last):
File "/usr/local/bin/buildozer", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3088, in <module>
@_call_aside
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3072, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 574, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 892, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 778, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'buildozer==0.40.dev0' distribution was not found and is required by the application
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/local/bin/buildozer", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3088, in <module>
@_call_aside
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3072, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 574, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 892, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 778, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'buildozer==0.40.dev0' distribution was not found and is required by the application
3
Answers
Edit the
.espc
file inside your directory, setandroid.sdk_path
(inside.spec
file) to the path of yourandroid-sdk
folder:Then save
.spec
. Hope it works.Download the SDK manager here:
wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
(run this on your command line in your buildozer directory)
Then you unzip it with the command:
$ unzip sdk-tools-linux-3859397.zip
when you see a tools directory you have successfully installed sdkmanager
Then edith your .spec file(in your kivy app folder) line 112 with the path where you unzipped your SDK file
andriod.sdk_path = (Your file path) eg /home/freezy/buildozer/
I had the same problem, so I just removed android-sdk folder in
home<username>.biuldozerandroidplatform (you can find it with CTRL+H)
and ran buildozer android debug command again.