I am trying to compile an .apk (this one) using buildozer. But I keep getting the command failed message below. I've tried using a different python path, reinstalling buildozer, using different buildozer paths, compiling from Mac HD, compiling with sudo, a different cython version. None work.
Traceback (most recent call last):
File "build.py", line 497, in
make_package(args)
File "build.py", line 351, in make_package
subprocess.check_call([ANT, arg])
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ant', 'debug']' returned non-zero exit status 1
Command failed: /usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python build.py --name 'My Application' --version 1.2.0 --package org.test.myapp --private /Users/user/Documents/Py/kvapk/.buildozer/android/app --sdk 14 --minsdk 8 --permission INTERNET --permission ACCESS_NETWORK_STATE --orientation portrait debug
I'm on OSX Mavericks using python 2.7.5, kivy 1.8.0, cython 0.19 and buildozer 0.17
Here is the total output: https://gist.github.com/feynman21/29d2f02c387112f2900b
This is an issue with buildozer failing to install the Android build-tools. Hopefully this will be fixed soon. Until then, you can work around this by manually installing build-tools (https://github.com/kivy/buildozer/issues/146#issuecomment-57061269):
Run ~/.buildozer/android/platform/android-sdk-21/tools/android to launch the Android SDK Manager. (If you have a different SDK version, replace android-sdk-21 with the appropriate folder)
Click the Deselect All link at the bottom of the window, and check the box next to "Android SDK Build-tools -- 20". (Note: the exact version doesn't matter, just pick the newest version available.)
Click the Install 1 package... button.
Click Accept License and then click the Install button.
Close the SDK Manager and resume working with buildozer.
Related
I'm trying package my kivy app (python3) but when i run the command buildozer -v android debug see this error
# Cwd /home/javier/.buildozer/android/platform/android-sdk
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.se.ee not found
# Command failed: /home/javier/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager tools platform-tools
#
# 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 have this Java version
$ java --version
openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118.04.3)
OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.04.3, mixed mode, sharing)
I downloaded only sdkmanager Command line tools from here and put it in my root path but i don't had success.
I Saw in this post a solution and i did it but i don't solve the error.
I has a virtualenv with all dependencies installed. Also i edited the buildozer.spec and i was custom it
The Virtualenv is:
(envAppSinapsis)~/AppSin$ pip freeze
certifi==2019.3.9
chardet==3.0.4
Cython==0.28.2
docutils==0.14
idna==2.8
Kivy==1.10.1
Kivy-Garden==0.1.4
psycopg2==2.7.6.1
psycopg2-binary==2.7.6.1
pygame==1.9.4.dev0
Pygments==2.3.1
requests==2.21.0
urllib3==1.24.1
I think that error is related to something related to JAVA but I do not know what. I would appreciate your helps, and please, excuse my bad English.
I am working in Ubuntu 18
UPDATE
Print Screen Error
Up until a few days ago if you had installed openjdk-11-jdk/jre from the Ubuntu repos you would have found it was actually a version of Java 10 (https://askubuntu.com/questions/1037646/why-is-openjdk-10-packaged-as-openjdk-11).
java.se.ee has been deprecated in Java 9, 10 and removed in Java 11 (https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html)
Unfortunately there is no simple way to get the Android tools like sdkmanager or avdmanager running with Java 11 yet.
I was able to get buildozer running on Ubuntu again with Java 10:
Download Java 10 Linux x64 JDK (.tar.gz) from http://jdk.java.net/java-se-ri/10
Untar: tar -xzvf jdk-10_linux-x64_bin_ri.tar.gz
Set PATH: export PATH=/path/to/inflated/jdk-10/bin:$PATH
was getting error License not accepted for SDK Build tools etc
solved by Installing
SDK Command Line Tools
Google Play licensing services
in SDK Manager > SDK Tools
helped me after getting frustrated for 2 hours, and hearing from everyone that only way is to downgrade Java
You can solve this error by downgrading Java or by executing the below command in your terminal.
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
Also, don't download the platform tools yourself, let buildozer take care of that.
If the above command doesn't work try deleting the buildozer files from your app and rebuilding your application.
I have a run.sh like this
virtualenv -p python3 env
source env/bin/activate
pip3 install -r requirements.txt
python3 -m profilo.workflow_demo trace.log blocks
When i run this on terminal it runs ok but when i run this shell in external tools android studio it raise an error.
/home/cpu10475-local/Desktop/python/run.sh: 2: /home/cpu10475-local/Desktop/python/run.sh: source: not found
/home/cpu10475-local/Desktop/python/run.sh: 3: /home/cpu10475-local/Desktop/python/run.sh: pip3: not found
Process finished with exit code 1
My tool config is here:
I think the External Tools in Android Studio doesn't support source. So you should try removing the first 2 lines and installing pip3 then run the module again.
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
so I am trying to deploy a simple program to my Galaxy S5 with Buildozer. I run buildozer --verbose android debug deploy run which goes fine until the very last part:
Traceback (most recent call last):
File "build.py", line 491, in <module>
make_package(args)
File "build.py", line 354, in make_package
subprocess.check_call([ANT, arg])
File "/usr/lib/python2.7/subprocess.py", line 511, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ant', 'debug']' returned non-zero exit status 1
# Command failed: /usr/bin/python build.py --name 'School Organized' --version 1.2.0 -- package org.test.schoolorganized --private /home/jolechiw/School-Organized/.buildozer/android/app --sdk 14 --minsdk 8 --orientation landscape debug
The last part of the output can be found here. I really dont understand what went wrong with "Command Failed" but it might be a path error? I am really not sure.
EDIT:
I dont know if this matters but my source code for the app is here
I had, I believe, the same problem recently, and I'm fairly sure the problem was really the name of my app.
I don't think you can have a space in the name 'School Organized'. Try removing that or replacing it with an underscore (or whatever), wherever it appears in your buildozer.spec file, and build again.
I don't really have a way to check this was definitely the same error as mine, but it was at the least very similar and this tweak definitely fixed it.
today I had the same building issue. The problem was in Java itself rather than in buildozer.
It MUST be done using Java 7:
piotr#jnlk ~/Kivy/SomeApp $ which java
/usr/bin/java
piotr#jnlk ~/Kivy/SomeApp $ java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
piotr#jnlk ~/Kivy/SomeApp $ buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
(...)
# Distribution already compiled, pass.
# Build the application #137
# Package the application
# Command failed: /usr/bin/python2 build.py (...) --orientation landscape debug
Building with Java8 fails, but when I changed JAVA_HOME variable to the location of Java7:
piotr#jnlk ~/Kivy/SomeApp $ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
piotr#jnlk ~/Kivy/SomeApp $ export PATH=${JAVA_HOME}/bin:${PATH}
piotr#jnlk ~/Kivy/SomeApp $ java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1~0.13.10.1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
piotr#jnlk ~/Kivy/SomeApp $ buildozer android debug
piotr#jnlk ~/Kivy/SomeApp $ buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
(...)
# Android packages installation done.
# Check application requirements
# Check garden requirements
# Compile platform
# Distribution already compiled, pass.
# Build the application #138
# Package the application
# Android packaging done!
# APK <some-app-name>.apk available in the bin directory
Building was completed successfully :)
Since yesterday, I have some problems with Cordova and Android. I can not create an functional Android App. iOS works.
In detail: I use a Mac (MacOS X 10.8.5) and have installed ADT 22.6.2 (with API 17/18/19) and added the sdk-tools to my PATH.
$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/adt/sdk/tools:/Applications /adt/sdk/platform-tools:/usr/local/MacGPG2/bin
My configuration:
$ node -v
v0.10.26
$ cordova -v
3.4.1-0.1.0
$ ant -version
Apache Ant(TM) version 1.8.2 compiled on June 20 2012
My attempt to create an Cordova App:
$ cordova create XY com.wb.XY XY
Creating a new cordova project with name "XY" and id "com.wb.XY" at location "/.../XY"
$ cd XY
XY wb$ cordova platform add ios
Creating ios project...
XY wb$ cordova platform add android
Creating android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.wb.XY
Name: XY
Android target: android-19
Copying template files...
Running: android update project --subprojects --path "platforms/android" --target android-19 --library "CordovaLib"
Resolved location of library project to: /.../XY/platforms/android/CordovaLib
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using Activity name 'XY'.
If you wish to change it, edit the first line of build.xml.
Added file platforms/android/build.xml
Added file platforms/android/proguard-project.txt
Updated project.properties
Updated local.properties
No project name specified, using project folder name 'CordovaLib'.
If you wish to change it, edit the first line of build.xml.
Added file platforms/android/CordovaLib/build.xml
Added file platforms/android/CordovaLib/proguard-project.txt
Project successfully created.
XY wb$ cordova platform list
Installed platforms: android 3.4.0, ios 3.4.1
Available platforms: amazon-fireos, blackberry10, firefoxos
XY wb$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git
Fetching plugin "https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git" via git clone
Installing "org.apache.cordova.inappbrowser" for android
Installing "org.apache.cordova.inappbrowser" for ios
XY wb$
What is going wrong? There is no directory „gen“.
If I try to import the project into ADT/Eclipse, I got the message:
Errors occurred during the build.
Errors running builder 'Android Resource Manager' on project 'XY'.
Errors running builder 'Android Pre Compiler' on project 'XY'.
Path must include project and resource name: /XY
and
/XY/gen already exists but is not a source folder. Convert to a source folder or rename it.
Eclipse generates a folder called „gen“, but it is empty.
EDIT: Here is what I tried based on the input given in answers and comments:
I have installed Node.js and Cordova 3.4:
$ node -v
v0.10.26
$ cordova -v
3.4.1-0.1.0
$ ant -version
Apache Ant(TM) version 1.8.2 compiled on June 20 2012
I have done this as you described with CLI.
The Android SDK is in the system path:
$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/adt/sdk/tools:/Applications/adt/sdk/platform-tools:/usr/local/MacGPG2/bin
Everything seems to be all right. Do you see any mistake? Do I need Apache Ant?
If I try to add android (without sudo), I have got the output shown in my question. Trying this as admin (with sudo), the result is the same.
With
$ cordova emulate android
I get:
...
BUILD SUCCESSFUL
Total time: 5 seconds
WARNING : no emulator specified, defaulting to Android_Tablet
Waiting for emulator...
2014-04-26 14:16:53.848 emulator64-arm[84081:f07] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper
emulator64-arm: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.
Booting up emulator (this may take a while)........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
It takes a very long time . . . after 15 minutes I broke off. The log at Eclipse shows always returning the same messages.
But with
$ cordova run android
I am able to install and launch the app on my Android-device. But if I try to import the project into Eclipse, the file XY.java is shown with many errors.
Do you have any idea what could be the problem?
I am still able to work with my existing apps (iOS and Android), but I can not create a new one for Android.
I am sharing with you the steps to create android PhoneGap app with cordova 3.4 version :-
1) Download and install Node.js.
2) Run this command on your terminal :-
$ sudo npm install -g cordova
3) Then create your project using following command :-
$ cordova create hello com.example.hello HelloWorld
4) Then before adding any platform , run the following command....Replace the path of android sdk with your system path :-
$ export PATH=${PATH}:/Users/taruna/Documents/adt-bundle-mac-x86_64-20131030/sdk/platform-tools:/Users/taruna/Documents/adt-bundle-mac-x86_64-20131030/sdk/tools
5) Now add your platform using following command :-
$ sudo cordova platform add android
6) Now you can successfully run your project on emulator using following command :-
$ cordova emulate android
And its done now.
`