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 + python3 #973

Closed
nesergen opened this issue Sep 25, 2019 · 2 comments
Closed

buildozer + python3 #973

nesergen opened this issue Sep 25, 2019 · 2 comments

Comments

@nesergen
Copy link

Versions

  • Python: v2, v3
  • OS: Linux Mint 18
  • Buildozer: 0.39

Description

trying to compile an Android app by Buildozer:

requirements = sqlite3,python3,kivy

Whith command :
python -m buildozer android debug

the error appear:
[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.

Into the pip3 the buildozer and p4a have been installed.

Trying to do the same thing using python 3 :
python3 -m buildozer android debug

Getting error:

$ python3 -m buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Система управления пакетами Debian «dpkg», версия 1.18.4 (amd64).
Это свободное программное обеспечение. См. условия распространения в
Универсальной общественной лицензии GNU версии 2 или более поздней.
НИКАКИЕ гарантии не предоставляются.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /home/sergen/.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"\' \'pep517\' \'pytoml\' \'virtualenv\''
# Cwd None
# Apache ANT found at /home/sergen/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/sergen/.buildozer/android/platform/android-sdk
# Android NDK found at /home/TERRA/Android/android-ndk-r17c
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=NewJeans_py3_App --bootstrap=sdl2 --requirements=sqlite3,python3,kivy,sdl2 --arch armeabi-v7a --copy-libs --local-recipes /home/TERRA/Android/python-for-android-master/pythonforandroid/recipes --color=always --storage-dir="/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/build" --ndk-api=21'
# Cwd /home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI: 26
[INFO]:    Available Android APIs are (24, 26)
[INFO]:    Requested API target 26 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK: /home/TERRA/Android/android-ndk-r17c
[INFO]:    Found NDK version 17c
[INFO]:    Getting NDK API version (i.e. minimum supported API) from user argument
[INFO]:    Found virtualenv at /home/sergen/.local/bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.9']
[INFO]:    Picking the latest gcc toolchain, here 4.9
[INFO]:    No existing dists meet the given requirements!
[INFO]:    No dist exists that meets your requirements, so one will be built.
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1192, in <module>
    main()
  File "/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 668, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 153, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 182, in build_dist_from_args
    blacklist=blacklist
  File "/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android/pythonforandroid/graph.py", line 269, in get_recipe_order_and_bootstrap
    obvious_conflict_checker(ctx, names, blacklist=blacklist)
  File "/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android/pythonforandroid/graph.py", line 176, in obvious_conflict_checker
    recipe = Recipe.get_recipe(name, ctx)
  File "/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 606, in get_recipe
    mod = import_recipe('pythonforandroid.recipes.{}'.format(name), recipe_file)
  File "/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 39, in import_recipe
    spec.loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/TERRA/Android/python-for-android-master/pythonforandroid/recipes/sdl2/__init__.py", line 1, in <module>
    from pythonforandroid.toolchain import BootstrapNDKRecipe, shprint, current_directory, info
ImportError: cannot import name 'BootstrapNDKRecipe'
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=NewJeans_py3_App --bootstrap=sdl2 --requirements=sqlite3,python3,kivy,sdl2 --arch armeabi-v7a --copy-libs --local-recipes /home/TERRA/Android/python-for-android-master/pythonforandroid/recipes --color=always --storage-dir="/home/TERRA/PythonExp/kivy_exp/new_jeans_v5_py3/.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

seem to be missing some package, but where it to take is not clear

buildozer.spec

Spec file:

[app]

p4a.local_recipes = /home/TERRA/Android/python-for-android-master/pythonforandroid/recipes/

# (str) Title of your application
title = NewJeans_py3

# (str) Package name
package.name = NewJeans_py3_App

# (str) Package domain (needed for android/ios packaging)
package.domain = org.new_jeans_xml

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas

# (list) Source files to exclude (let empty to not exclude anything)
source.exclude_exts = spec

# (list) List of directory to exclude (let empty to not exclude anything)
source.exclude_dirs = tests, bin, new_jeans

# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
#version.regex = __version__ = ['"](.*)'['"]
#version.filename = %(source.dir)s/main.py

# (str) Application versioning (method 2)
version = 5.1

# (list) Application requirements
requirements = sqlite3,python3,kivy

# (list) Garden requirements
#garden_requirements =

# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png

# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png

# (str) Supported orientation (one of landscape, portrait or all)
orientation = portrait

# (bool) Indicate if the application should be fullscreen or not
fullscreen = 1


#
# Android specific
#

# (list) Permissions
android.permissions = WRITE_EXTERNAL_STORAGE, WAKE_LOCK,READ_EXTERNAL_STORAGE,ACCESS_CHECKIN_PROPERTIES

# (int) Android API to use
android.api = 26

# (int) Minimum API required (8 = Android 2.2 devices)
#android.minapi = 21

# (int) Android SDK version to use
#android.sdk = 24

# (str) Android NDK version to use
android.ndk = 17c

# (bool) Use --private data storage (True) or --dir public storage (False)
android.private_storage = False

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path = /home/TERRA/Android/android-ndk-r17c

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
#android.sdk_path = /home/TERRA/android-studio/sdk

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#android.p4a_dir = /home/TERRA/Android/python-for-android-master/

# (list) python-for-android whitelist
#android.p4a_whitelist = lib-dynload/future_builtins.so

# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity

# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don't add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar

# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
#android.add_src =

# (str) python-for-android branch to use, if not master, useful to try
# not yet merged features.
#android.branch = master

# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
#android.ouya.category = GAME

# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png

# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =

# (list) Android additionnal libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_x86 = libs/android-x86/*.so
#android.add_libs_mips = libs/android-mips/*.so

# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True
android.wakelock = True

# (list) Android application meta-data to set (key=value format)
#android.meta_data =

# (list) Android library project to add (will be added in the
# project.properties automatically.)
#android.library_references =

#
# iOS specific
#

# (str) Name of the certificate to use for signing the debug version
# Get a list of available identities: buildozer ios list_identities
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"

# (str) Name of the certificate to use for signing the release version
#ios.codesign.release = %(ios.codesign.debug)s


[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2


# -----------------------------------------------------------------------------
# List as sections
#
# You can define all the "list" as [section:key].
# Each line will be considered as a option to the list.
# Let's take [app] / source.exclude_patterns.
# Instead of doing:
#
#     [app]
#     source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
# This can be translated into:
#
#     [app:source.exclude_patterns]
#     license
#     data/audio/*.wav
#     data/images/original/*
#


# -----------------------------------------------------------------------------
# Profiles
#
# You can extend section / key with a profile
# For example, you want to deploy a demo version of your application without
# HD content. You could first change the title to add "(demo)" in the name
# and extend the excluded directories to remove the HD content.
#
#     [app@demo]
#     title = My Application (demo)
#
#     [app:source.exclude_patterns@demo]
#     images/hd/*
#
# Then, invoke the command line with the "demo" profile:
#
#     buildozer --profile demo android debug
@AndreMiras
Copy link
Member

I would drop that line from your buildozer.spec
p4a.local_recipes = /home/TERRA/Android/python-for-android-master/pythonforandroid/recipes/
local recipes are only for custom recipe use, but here you're making it point to the p4a one.
Next is make sure buildozer is uninstalled from Python2 pip via pip uninstall buildozer and then install from master branch on Python3 via: pip3 install --user --upgrade https://github.com/kivy/buildozer/archive/e58ad28.zip.

@nesergen
Copy link
Author

I would drop that line from your buildozer.spec p4a.local_recipes = /home/TERRA/Android/python-for-android-master/pythonforandroid/recipes/

now all work fine. Thanks !

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

2 participants