question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashing on startup- ImportError: dlopen failed: _imaging.so is 64-bit

See original GitHub issue

EDIT: https://github.com/kivy/kivy/issues/4095 seems to be the same issue, but nobody has gotten an answer from there.

Hi, when I run an apk which has the pillow imported in it (from PIL import Image) it will crash on startup citing this, and force closing: ImportError: dlopen failed: "/data/data/org.benjimaestro.hypertext/files/app/lib/python2.7/site-packages/PIL/_imaging.so" is 64-bit instead of 32-bit

My buildozer.spec is this:


# (str) Title of your application
title = HyperText

# (str) Package name
package.name = hypertext

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

# (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) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png

# (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

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

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = kivy,hostpython2,plyer,android,pil,pillow

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy

# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY

#
# OSX Specific
#

#
# author = © Copyright Info

# change the major version of python used by the app
osx.python_version = 3

# Kivy version to use
osx.kivy_version = 1.9.1

#
# Android specific
#

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

# (list) Permissions
android.permissions = INTERNET,VIBRATE,BIND_NOTIFICATION_LISTENER_SERVICE,STATUS_BAR

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

# (int) Minimum API required
android.minapi = 9

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

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

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

# (str) python-for-android branch to use, defaults to master
#p4a.branch = stable

# (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 =
# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = True

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
#android.ndk_path =

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
#android.sdk_path =

# (str) ANT directory (if empty, it will be automatically downloaded.)
#android.ant_path =

# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package
# android.skip_update = False

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

# (list) Pattern to whitelist for the whole project
#android.whitelist =

# (str) Path to a custom whitelist file
#android.whitelist_src =

# (str) Path to a custom blacklist file
#android.blacklist_src =

# (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 =

# (list) Android AAR archives to add (currently works only with sdl2_gradle
# bootstrap)
#android.add_aars =

# (list) Gradle dependencies to add (currently works only with sdl2_gradle
# bootstrap)
#android.gradle_dependencies =

# (str) python-for-android branch to use, defaults to master
#p4a.branch = stable

# (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

# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
android.arch = armeabi-v7a

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
p4a.source_dir = /home/benjamin/python-for-android

# (str) Bootstrap to use for android builds
# p4a.bootstrap = sdl2

I am using Python 3.5 64bit on Ubuntu 64bit. The Pillow module was installed with pip.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
inclementcommented, Nov 18, 2017

Thanks @AndreMiras, I’ll close this. If there are specific issues with the pil recipe, feel free to open a new issue about them.

For what it’s worth, I intend to look at fixing up the recipes after the next release.

1reaction
010130521commented, Mar 23, 2018

I’ve been trying to fix this error for a pretty long time. I did what you said and now my app is running on Android. Thank you @AndreMiras You are my personal jesus christ 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashing on startup- ImportError: dlopen failed: _imaging.so is ...
App crashing on startup - ImportError: dlopen failed: _imaging.so is 64-bit. ... PIL import Image) it will crash on startup citing this, and...
Read more >
0 - Stack Overflow
I am trying to build android apk for my existing python Kivy desktop application which includes opencv library.
Read more >
import error dlopen - You.com | The Search Engine You Control
kivy/python-for-androidApp crashing on startup - Import Error: dlopen failed: _portaudio.so is 64 bit instead of 32 bit#1953. Created over 3 years ago.
Read more >
buildozer - Python Package Health Analysis - Snyk
Generic Python packager for Android / iOS and Desktop For more ... App crashing on startup- ImportError: dlopen failed: _imaging.so is 64-bit #568...
Read more >
buildozer 0.36 - PyPI
Generic Python packager for Android / iOS and Desktop. ... App crashing on startup- ImportError: dlopen failed: \_imaging.so is 64-bit ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found