I run buildozer android debug and I see this:
# Read available permissions from api-versions.xml
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/hamid/Desktop/myfirstkivy/.buildozer/android/platform/build'
# Cwd /home/hamid/Desktop/myfirstkivy/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]: Will compile for the following archs: armeabi-v7a
[INFO]: Found Android API target in $ANDROIDAPI
[INFO]: Available Android APIs are ()
[WARNING]: Requested API target 19 is not available, install it with the SDK android tool.
[WARNING]: Exiting.
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/hamid/Desktop/myfirstkivy/.buildozer/android/platform/build
#
# 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.
As you can see , there is no android API.
And when I tried to install an API using android sdk manager at ~/.buildozer/android/platform/android-sdk-20/tools/android there where no API to install it :
How I can install API for android SDK? Can I download SDK or API manually and connect it to buildozer? Why buildozer can not download correct SDK?
While trying to just run the example program on my Android phone, I got this error while running buildozer android debug deploy run.
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Install platform
# Apache ANT found at /Users/USER/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /Users/USER/.buildozer/android/platform/android-sdk-20
# Android NDK found at /Users/USER/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Check garden requirements
# Compile platform
# Command failed: /Users/USER/miniconda3/envs/Kivy2New/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/Users/USER/Desktop/TestKivy/.buildozer/android/platform/build
#
# Buildozer failed to execute the last command
# If the error is not obvious, please raise the log_level to 2
# and retry the latest command.
# In case of a bug report, please add a full log with log_level = 2
All with after just installing Kivy, Cython 0.19 and running buildozer init.
The full log with level 2 here.
I am running Anaconda on OSX with Python 2 (But same error occurs when on Python 3).
Thanks!
I am new to kivy, and try to build an app for android using kivy.
When i was creating an apk for the app
buildozer android debug
with log_level=2
it shows:
Tool unzip is missing
Command failed: ./distribute.sh -m "kivy" -d "kivytut"
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'm unable to find any tool called upzip for buidozer(python-for-android) on the internet.
Help.
install unzip using:
sudo apt-get install unzip
moreover following are the tools that must be installed:
git
ant
python2
cython (can be installed via pip)
a Java JDK (e.g. openjdk-7)
zlib (including 32 bit)
libncurses (including 32 bit)
unzip
virtualenv (can be installed via pip)
ccache (optional)
These are several dependencies for python-for-android
I trying to build a test project just to see if the installation works but I get this error almost instantly.....
/home/kivy/Android/sdk/platform-tools/tools/android
I have installed Android Studio and ran updates. I installed the 14(android 4.0) tools needed. I downloaded the NDK and even though Android Studio created a new Android folder with folders like tools, platform, platform-tools, etc I still downloaded the standalone folder Android-Linux (r24.4.1).
Android-Linux and the NDK are sitting at home/documents/sdk_ndk/...
The Android folder created by Android Studio is sitting at home/Android
Android Studio itself is with the NDK and Android-Linux folders.
.bashrc has...
export ANDROIDSDK=$HOME/Documents/sdk_ndk/android-sdk-r24.4.1
export ANDROIDNDK=$HOME/Documents/sdk_ndk/android-ndk-r13b
export ANDROIDAPI="14"
export ANDROIDNDKVER="r13b"
I've even tried....
export ANDROIDSDK=$HOME/Android/sdk
export ANDROIDNDK=$HOME/Documents/sdk_ndk/android-ndk-r13b
export ANDROIDAPI="14"
export ANDROIDNDKVER="r13b"
Build commands are....
p4a apk --private ~/Desktop/testapp --package=org.example.myapp --name "testapp" --version 0.1 --bootstrap=sdl2 --requirements=python2,kivy
When I set this...
export ANDROIDSDK=$HOME/Documents/sdk_ndk/android-sdk-r24.4.1
Api target 14 is not found.
When I set this...
export ANDROIDSDK=$HOME/Android/sdk
I don't get an api error but I get the path error.
not found /home/kivy/Android/sdk/platform-tools/tools/android
I've even tried...
export ANDROIDSDK=$HOME/Android/sdk/tools
export ANDROIDSDK=$HOME/Android/sdk/platform-tools
-------Update-------------------
I've added the '"' around paths.....
export ANDROIDSDK="$Home/Documents/sdk_ndk/android-sdk-r24.4.1"
#export ANDROIDSDK="$Home/Android/sdk"
export ANDROIDNDK="$Home/Documents/sdk_ndk/android-ndk-r13b"
export ANDROIDAPI="14"
export ANDROIDNDKVER="r13b"
And now get and error saying it cant find /tools/android. This is strange because there is an Android file in the tools folder. It doesn't have the .sh extension, but it's there.
Here's the whole terminal output......
kivy#kivy-VirtualBox:~$ p4a apk --private ~/Desktop/testapp --package=org.urchatty.com --name "testapp" --version 0.1 --bootstrap=sd12 --requirements=python2,kivy
[INFO]: This python-for-android revamp is an experimental alpha release!
[INFO]: It should work (mostly), but you may experience missing features or bugs.
[INFO]: Will compile for the following archs: armeabi
[INFO]: Found Android API target in $ANDROIDAPI
Traceback (most recent call last):
File "/usr/local/bin/p4a", line 9, in <module>
load_entry_point('python-for-android==0.4', 'console_scripts', 'p4a')()
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 754, in main
ToolchainCL()
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 343, in __init__
getattr(self, command_method_name)(unknown)
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/toolchain.py", line 87, in wrapper_func
user_ndk_ver=self.ndk_version)
File "/usr/local/lib/python2.7/dist-packages/pythonforandroid/build.py", line 226, in prepare_build_environment
android = sh.Command(join(sdk_dir, 'tools', 'android'))
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1029, in __init__
raise CommandNotFound(path)
sh.CommandNotFound: /Documents/sdk_ndk/android-sdk-r24.4.1/tools/android
kivy#kivy-VirtualBox:~$
---------Update-------------------------
Seems like my paths in the bashrc had to be written as.... "/home/kivy/....". I didn't get far before another error hit me....
kivy#kivy-VirtualBox:~$ p4a apk --private $HOME/code/myapp --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python2,kivy
[INFO]: This python-for-android revamp is an experimental alpha release!
[INFO]: It should work (mostly), but you may experience missing features or bugs.
[INFO]: Will compile for the following archs: armeabi
[INFO]: Found Android API target in $ANDROIDAPI
[INFO]: Available Android APIs are (4, 19)
[INFO]: Requested API target 19 is available, continuing.
[INFO]: Found NDK dir in $ANDROIDNDK
[INFO]: Got NDK version from $ANDROIDNDKVER
[INFO]: Using Google NDK r13b
[INFO]: Found virtualenv at /usr/local/bin/virtualenv
[WARNING]: ndk_platform doesn't exist: /home.kivy/Documents/android-ndk-r13b/platforms/android-19/arch-arm
[WARNING]: Could not find toolchain subdirectory!
[WARNING]: Could not find any toolchain for arm-linux-androideabi!
[WARNING]: Missing executable: autoconf is not installed
[WARNING]: Missing executable: automake is not installed
[WARNING]: Missing executable: libtoolize is not installed
[ERROR]: python-for-android cannot continue; aborting
kivy#kivy-VirtualBox:~$
EL3PHANTEN's answer made the difference.
# $ANDROIDSDK/tools/android update sdk --no-ui --filter 2,3,15
Using the terminal instead of the Manager seemed to help. The files downloaded for the SDK were actually less. They were much larger using the SDK Manager UI.
The other trick was in the bashrc. Paths had to start with "/" only.
"/home/kivy/Documents/...."
Finally, p4a is doing it's thing. The Kivy Website really should update it's Docs to include what EL3PHANTEN purposed. Also, the path styles used in the documents...
export ANDROIDSDK="$HOME/Documents/android-sdk-21"
export ANDROIDNDK="$HOME/Documents/android-ndk-r10e"
export ANDROIDAPI="14" # Minimum API version your application require
export ANDROIDNDKVER="r10e" # Version of the NDK you installed
That doesn't cut if for some reason. I could have save myself a lot of bandwidth and time if I would have gotten help from EL3PHANTEN earlier instead of doing everything on the Kivy Website as is.
The only thing on my mind now is, what error will I run into next? Obviously the Docs on this stuff isn't 100 percent.
As your error says, it cannot find android which should be in your sdk/tools folder. So eiter your ANDROIDSDK variable is wrong, or your tools folder does not contain android
If its the path variable, check the path of your sdk.
If your android executable is missing, try following steps when updating the sdk.
You probably updated everything, without choosing packages.
That means your tools folder might be empty now.
What you can do now, is to eiter find the packed tools folder in /home/kivy/Android/sdk/platform-tools/temp, or delete the whole sdk folder and try again.
The correct way to update the android-sdk is this:
(the following procedure takes less time, since you dont need all the packages)
First download and unpack the sdk.
Since we dont need all the packages, we first want a list of available packages.
# ANDROIDSDK="$HOME/Android/sdk"
# $ANDROIDSDK/tools/android list sdk
Now we get a list of packages.
We need to install the build_tools and the platform_tools, which in my case show as 2 and 3. Also we need SDK Platform Android 4.0.3, API 15 since we chose API version 15. This package is incidentally also shown as 15 in my case. (or whatever API you want)
So we add the filter 2,3,15.
Be sure NOT to install Android SDK Tools which is shown as 1 in my case. This will empty the tools folder, and we dont want that.
Note
Your filter might be different, then explained above.
Then run this command to install the packages you chose:
# $ANDROIDSDK/tools/android update sdk --no-ui --filter 2,3,15
I am trying to follow the instructions on https://kivy.org/docs/guide/packaging-android-vm.html to create kivy android applications. I installed Kivy Buildozer VM and was following instructions on the Readme file. Created the buildozer.spec file using buildozer init command but buildozer android debugis failing with following output
# 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.17.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-7-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
# -> found at /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
# Install platform
# Apache ANT found at /home/kivy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/kivy/.buildozer/android/platform/android-sdk-21
# Android NDK found at /home/kivy/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Run './distribute.sh -l'
# Cwd /media/sf_virtual_box/organizer/2nd_vid_tute/tut1_vid4/.buildozer/android/platform/python-for-android
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PYTHON-FOR-ANDROID ERROR! SEE BELOW FOR SOLUTION:
You are trying to run an old version of python-for-android via
distribute.sh. However, python-for-android has been rewritten and no
longer supports the distribute.sh interface.
If you are using buildozer, you should:
- upgrade buildozer to the latest version (at least 0.30)
- delete the .buildozer folder in your app directory (the same directory that has your buildozer.spec)
- run buildozer again as normal
If you are not using buildozer, see
https://github.com/kivy/python-for-android/blob/master/README.md for
instructions on using the new python-for-android
toolchain. Alternatively, you can get the old toolchain from the
'old_toolchain' branch at
https://github.com/kivy/python-for-android/tree/old_toolchain .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Command failed: ./distribute.sh -l
#
# 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
Then I tried to update using buildozer android update But fails giving the following output
# 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.17.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-7-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
# -> found at /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
# Install platform
# Run 'git clean -dxf'
# Cwd /media/sf_virtual_box/organizer/2nd_vid_tute/tut1_vid4/.buildozer/android/platform/python-for-android
# Run 'git pull origin master'
# Cwd /media/sf_virtual_box/organizer/2nd_vid_tute/tut1_vid4/.buildozer/android/platform/python-for-android
From https://github.com/kivy/python-for-android
* branch master -> FETCH_HEAD
Already up-to-date.
# Apache ANT found at /home/kivy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/kivy/.buildozer/android/platform/android-sdk-21
# Android NDK found at /home/kivy/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Run './distribute.sh -l'
# Cwd /media/sf_virtual_box/organizer/2nd_vid_tute/tut1_vid4/.buildozer/android/platform/python-for-android
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PYTHON-FOR-ANDROID ERROR! SEE BELOW FOR SOLUTION:
You are trying to run an old version of python-for-android via
distribute.sh. However, python-for-android has been rewritten and no
longer supports the distribute.sh interface.
If you are using buildozer, you should:
- upgrade buildozer to the latest version (at least 0.30)
- delete the .buildozer folder in your app directory (the same directory that has your buildozer.spec)
- run buildozer again as normal
If you are not using buildozer, see
https://github.com/kivy/python-for-android/blob/master/README.md for
instructions on using the new python-for-android
toolchain. Alternatively, you can get the old toolchain from the
'old_toolchain' branch at
https://github.com/kivy/python-for-android/tree/old_toolchain .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Command failed: ./distribute.sh -l
#
# 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
How can I fix this?
If you are gettting this error in the Kivy Android Build Image you should update buildozer like this:
1.type
sudo pip install -U buildozer
2. delete the .buildozer folder in your app folder
The sudo password for this image is kivy123
type
buildozer -v android debug
to see what happens during compilation.
As you can see here python-for-android the distribute.sh file is not supposed to be used anymore. Here you have a guide how to use buildozer directly.