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

Python project build Buildozer issue - Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package with dots replaced with underscores #1391

Closed
tito opened this issue Oct 4, 2018 · 1 comment

Comments

@tito
Copy link
Member

tito commented Oct 4, 2018

@Nik-Lz commented on Sun Jul 15 2018

I am trying to port my python project to Android.

I followed instructions here https://kivy.org/docs/guide/packaging-android.html and here: http://inclem.net/2014/01/12/kivy-crash-course/2_building_an_android_apk/

I did:
sudo pip install --upgrade cython==0.21; sudo dpkg --add-architecture i386; sudo apt-get update; sudo apt-get install build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386
Then went on to my python project and did:
buildozer init
I changed the include files and directories (included more of them) on the generated buildozer.spec
and a couple of other settings (fullscreen=1 & included some more libraries).

I have java 8 installed (sudo apt install openjdk-8-jre, sudo apt install openjdk-8-jdk) and working properly.

Finally I hit buildozer android debug to build the project and after it downloads everything, I get the info message I mentioned in the title above, followed by:

`[WARNING]: ERROR: .../.buildozer/android/platform/android-ndk-r9c/ndk-build failed!

Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=packageName098 --bootstrap=sdl2 --requirements=kivy,pygame,configobj --arch armeabi-v7a --copy-libs --color=always --storage-dir=.../.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.
In case of a bug report, please add a full log with log_level = 2`

I am not very familiar with Kivy. My goal is to port my Python app so it can run on Android. Can you make something out of this and let me know what the issue is?

I'm on Ubuntu 16.04 x86_64 (not a VM) and using Python 2.7.


@tshirtman commented on Mon Jul 16 2018

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`

Please follow these instructions :)


@Nik-Lz commented on Mon Jul 16 2018

Here's the full log:

# 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.18.4 (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/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 'pip install -q --user "appdirs" "colorama>=0.3.3" "sh>=1.10,<1.12.5" "jinja2" "six"'
# Cwd None
# Apache ANT found at /home/username/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/username/.buildozer/android/platform/android-sdk-20
# Android NDK found at /home/username/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=myProjectNamePackage543 --bootstrap=sdl2 --requirements=kivy,pygame,configobj --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/username/Desktop/myProjectName/.buildozer/android/platform/build'
# Cwd /home/username/Desktop/myProjectName/.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 (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 r9c
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.6', '4.8', 'clang3.3']
[INFO]:    Picking the latest gcc toolchain, here 4.8
[WARNING]: Missing executable: libtoolize is not installed
[INFO]:    No existing dists meet the given requirements!
[INFO]:    No dist exists that meets your requirements, so one will be built.
[INFO]:    Found a single valid recipe set: [u'configobj', 'hostpython2', 'pygame_bootstrap_components', 'python2', 'sdl', 'six', 'pygame', 'pyjnius', u'kivy']
[INFO]:    The selected bootstrap is sdl2_gradle
[INFO]:    # Creating dist with sdl2_gradle bootstrap
[INFO]:    Dist will have name myProjectNamePackage543 and recipes (kivy, pygame, configobj)
[INFO]:    Dist will also contain modules (configobj) installed from pip
[INFO]:    -> running cp -r /home/username/Desktop/myProjectName/.buildozer/android/p...(and 195 more)
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Recipe build order is ['hostpython2', 'pygame_bootstrap_components', 'python2', 'sdl', 'six', 'pygame', 'pyjnius', u'kivy']
[INFO]:    The requirements (configobj) were not found as recipes, they will be installed with pip.
[INFO]:    # Downloading recipes 
[INFO]:    Downloading hostpython2
[INFO]:    -> running mkdir -p /home/username/Desktop/myProjectName/.buildozer/androi...(and 37 more)
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/packages/hostpython2
[INFO]:    -> running basename https://python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2
[INFO]:    hostpython2 download already cached, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Downloading pygame_bootstrap_components
[INFO]:    -> running mkdir -p /home/username/Desktop/myProjectName/.buildozer/androi...(and 53 more)
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/packages/pygame_bootstrap_components
[INFO]:    -> running basename https://github.com/kivy/p4a-pygame-bootstrap-components/archive/master.zip
[INFO]:    pygame_bootstrap_components download already cached, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Downloading python2
[INFO]:    -> running mkdir -p /home/username/Desktop/myProjectName/.buildozer/androi...(and 33 more)
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/packages/python2
[INFO]:    -> running basename https://python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2
[INFO]:    python2 download already cached, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Downloading sdl
[INFO]:    Skipping sdl download as no URL is set
[INFO]:    Downloading six
[INFO]:    -> running mkdir -p /home/username/Desktop/myProjectName/.buildozer/androi...(and 29 more)
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/packages/six
[INFO]:    -> running basename https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz
[INFO]:    six download already cached, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Downloading pygame
[INFO]:    -> running mkdir -p /home/username/Desktop/myProjectName/.buildozer/androi...(and 32 more)
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/packages/pygame
[INFO]:    -> running basename http://pygame.org/ftp/pygame-1.9.1release.tar.gz
           working: pygame-1.9.1release.tar.gz                 [INFO]:    pygame download already cached, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Downloading pyjnius
[INFO]:    -> running mkdir -p /home/username/Desktop/myProjectName/.buildozer/androi...(and 33 more)
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/packages/pyjnius
[INFO]:    -> running basename https://github.com/kivy/pyjnius/archive/master.zip
[INFO]:    pyjnius download already cached, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Downloading kivy
[INFO]:    -> running mkdir -p /home/username/Desktop/myProjectName/.buildozer/androi...(and 30 more)
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/packages/kivy
[INFO]:    -> running basename https://github.com/kivy/kivy/archive/1.10.0.zip
[INFO]:    kivy download already cached, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    # Building all recipes for arch armeabi-v7a
[INFO]:    # Unpacking recipes
[INFO]:    Unpacking hostpython2 for armeabi-v7a
[INFO]:    -> running basename https://python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop
[INFO]:    hostpython2 is already unpacked, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Unpacking pygame_bootstrap_components for armeabi-v7a
[INFO]:    -> running basename https://github.com/kivy/p4a-pygame-bootstrap-components/archive/master.zip
            [INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni
[INFO]:    -> running mv p4a-pygame-bootstrap-components-master /home/username/Desktop/...(and 117 more)
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Unpacking python2 for armeabi-v7a
[INFO]:    -> running basename https://python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/other_builds/python2/armeabi-v7a
[INFO]:    python2 is already unpacked, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Unpacking sdl for armeabi-v7a
[INFO]:    Skipping sdl unpack as no URL is set
[INFO]:    Unpacking six for armeabi-v7a
[INFO]:    -> running basename https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/other_builds/six-python2/armeabi-v7a
[INFO]:    six is already unpacked, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Unpacking pygame for armeabi-v7a
[INFO]:    -> running basename http://pygame.org/ftp/pygame-1.9.1release.tar.gz
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/other_builds/pygame/armeabi-v7a
[INFO]:    pygame is already unpacked, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Unpacking pyjnius for armeabi-v7a
[INFO]:    -> running basename https://github.com/kivy/pyjnius/archive/master.zip
                                                                                [INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/other_builds/pyjnius-python2-sdl/armeabi-v7a
[INFO]:    pyjnius is already unpacked, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Unpacking kivy for armeabi-v7a
[INFO]:    -> running basename https://github.com/kivy/kivy/archive/1.10.0.zip
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/other_builds/kivy-pygame-python2/armeabi-v7a
[INFO]:    kivy is already unpacked, skipping
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    # Prebuilding recipes
[INFO]:    Prebuilding hostpython2 for armeabi-v7a
[INFO]:    -> running cp /home/username/Desktop/myProjectName/.buildozer/android/plat...(and 218 more)
[INFO]:    Prebuilding pygame_bootstrap_components for armeabi-v7a
[INFO]:    Unpacking pygame bootstrap JNI dir components
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni
[INFO]:    sdl dir exists, so it looks like the JNI componentsare already unpacked. Skipping.
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Prebuilding python2 for armeabi-v7a
[INFO]:    python2 has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for python2[armeabi-v7a]
[INFO]:    python2 already patched, skipping
[INFO]:    Prebuilding sdl for armeabi-v7a
[INFO]:    sdl has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding six for armeabi-v7a
[INFO]:    six has no prebuild_armeabi_v7a, skipping
[INFO]:    Prebuilding pygame for armeabi-v7a
[INFO]:    Applying patches for pygame[armeabi-v7a]
[INFO]:    pygame already patched, skipping
[INFO]:    Prebuilding pyjnius for armeabi-v7a
[INFO]:    pyjnius has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for pyjnius[armeabi-v7a]
[INFO]:    pyjnius already patched, skipping
[INFO]:    Prebuilding kivy for armeabi-v7a
[INFO]:    kivy has no prebuild_armeabi_v7a, skipping
[INFO]:    # Building recipes
[INFO]:    Building hostpython2 for armeabi-v7a
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2
[INFO]:    hostpython already exists, skipping build
[INFO]:    <- directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Building pygame_bootstrap_components for armeabi-v7a
[INFO]:    Building python2 for armeabi-v7a
[INFO]:    Copying hostpython binary to targetpython folder
[INFO]:    -> running cp /home/username/Desktop/myProjectName/.buildozer/android/plat...(and 209 more)
[INFO]:    Building sdl for armeabi-v7a
[INFO]:    -> directory context /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni
[INFO]:    -> running ndk-build V=1
Exception in thread background thread for pid 28294:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/username/.local/lib/python2.7/site-packages/sh.py", line 2170, in background_thread
    handle_exit_code(exit_code)
  File "/home/username/.local/lib/python2.7/site-packages/sh.py", line 1929, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/username/.local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
    raise exc
ErrorReturnCode_2: 

  RAN: /home/username/.buildozer/android/platform/android-ndk-r9c/ndk-build V=1

  STDOUT:
/home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/sdl_main/Android.mk:8: *** Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package with dots replaced with underscores, for example "com_example_SanAngeles".  Stop.


  STDERR:


[INFO]:    STDOUT:
	/home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni/sdl_main/Android.mk:8: *** Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package with dots replaced with underscores, for example "com_example_SanAngeles".  Stop.
[INFO]:    STDERR:
	
[INFO]:    COMMAND:
cd /home/username/Desktop/myProjectName/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle-python2/jni && /home/username/.buildozer/android/platform/android-ndk-r9c/ndk-build V=1

[WARNING]: ERROR: /home/username/.buildozer/android/platform/android-ndk-r9c/ndk-build failed!
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myProjectNamePackage543 --bootstrap=sdl2 --requirements=kivy,pygame,configobj --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/username/Desktop/myProjectName/.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.
# In case of a bug report, please add a full log with log_level = 2

It appears that in /usr/lib/python2.7/threading.py __bootstrap_inner self.run() method encounters an error. and lib/python2.7/site-packages/sh.py file throws exit code ErrorReturnCode_2:


@philippschaefer4 commented on Mon Jul 23 2018

I have the same issue. With me it seems to have something to do with pygame, opencv and pillow. So basically all libs for image processing.(I'd be thankful for any alternatives) when i leave the out everything ist eine.
The error seems to say: define that environment variable! I think it wants a repository with java sdl Code.

@inclement
Copy link
Member

Closing as stale: pygame is deprecated by us now, and pillow is known to work with the next recipe, which covers two of the cases mentioned above.
Feel free to reopen if this is still a current issue.

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