Closed AlexPicaro closed 7 years ago
You can debug the application using logcat. With buildozer, you can get this with buildozer android logcat
.
If you can't resolve the problem with that information, please post the full details including this log on the kivy-users mailing list.
I have the log from logcat (linked in the original post, as it is ~14000 lines long), but I can't make sense of it. The line that seems to cause the crash is
unable to stat file for the executable "/system/bin/sh": Permission denied
I'll post in the kivy-users mailing list.
Oh, sorry, I missed that. The important part is as below. It looks like dlib has compiled components and will need a recipe to work with p4a. Although the error is about 64 vs 32 bit, it's likely that it's only 64 bit because it's built for the wrong (desktop) architecture.
08-21 17:21:17.626 10478 10554 I python : [INFO ] [OSC ] using <thread> for socket
08-21 17:21:17.633 10478 10554 I python : [INFO ] [Window ] Provider: sdl2
08-21 17:21:17.641 10478 10554 W linker : /data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/kivy/graphics/cgl_backend/cgl_glew.so: is missing DT_SONAME will use basename as a replacement: "cgl_glew.so"
08-21 17:21:17.642 10478 10554 W linker : /data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/kivy/graphics/cgl_backend/cgl_gl.so: is missing DT_SONAME will use basename as a replacement: "cgl_gl.so"
08-21 17:21:17.650 303 1128 D IMGSRV : gralloc_device_alloc:1305: hnd=0x7e2d356640 ID=25274 fd=90 ref=0 1536(1536)x2048-0x1 usage=0xb00 size=12582912(12582912) cache=0
08-21 17:21:17.650 10478 10554 D IMGSRV : gralloc_register_buffer:1583: hnd=0xc840c8c0 ID=25274 fd=66 ref=1
08-21 17:21:17.652 10478 10554 I python : [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
08-21 17:21:17.653 10478 10554 I python : [INFO ] [GL ] Backend used <gl>
08-21 17:21:17.653 10478 10554 I python : [INFO ] [GL ] OpenGL version <OpenGL ES 3.2 build 1.7@4167538>
08-21 17:21:17.653 10478 10554 I python : [INFO ] [GL ] OpenGL vendor <Imagination Technologies>
08-21 17:21:17.654 10478 10554 I python : [INFO ] [GL ] OpenGL renderer <PowerVR Rogue GX6250>
08-21 17:21:17.654 10478 10554 I python : [INFO ] [GL ] OpenGL parsed version: 3, 2
08-21 17:21:17.654 10478 10554 I python : [INFO ] [GL ] Texture max size <8192>
08-21 17:21:17.654 10478 10554 I python : [INFO ] [GL ] Texture max units <16>
08-21 17:21:17.682 10478 10554 I python : [INFO ] [Shader ] fragment shader: <Success.>
08-21 17:21:17.690 10478 10554 I python : [INFO ] [Shader ] vertex shader: <Success.>
08-21 17:21:17.692 10478 10554 I python : [INFO ] [Window ] auto add sdl2 input provider
08-21 17:21:17.693 10478 10554 I python : [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
08-21 17:21:17.699 10478 10554 W linker : /data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/kivy/core/text/text_layout.so: is missing DT_SONAME will use basename as a replacement: "text_layout.so"
08-21 17:21:17.701 10478 10554 W linker : /data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/kivy/core/text/_text_sdl2.so: is missing DT_SONAME will use basename as a replacement: "_text_sdl2.so"
08-21 17:21:17.703 10478 10554 I python : [INFO ] [Text ] Provider: sdl2
08-21 17:21:17.721 10478 10554 I python : Traceback (most recent call last):
08-21 17:21:17.721 10478 10554 I python : File "/home/alexandre/Desktop/Demo/.buildozer/android/app/main.py", line 26, in <module>
08-21 17:21:17.721 10478 10554 I python : File "/home/alexandre/Desktop/Demo/.buildozer/android/app/kivyCam.py", line 17, in <module>
08-21 17:21:17.721 10478 10554 I python : File "/home/alexandre/Desktop/Demo/.buildozer/android/app/faceDetector.py", line 13, in <module>
08-21 17:21:17.722 10478 10554 I python : File "/home/alexandre/Desktop/Demo/.buildozer/android/platform/build/dists/etsdemo/private/lib/python2.7/site-packages/dlib/__init__.py", line 1, in <module>
08-21 17:21:17.722 10478 10554 I python : ImportError: dlopen failed: "/data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/dlib/dlib.so" is 64-bit instead of 32-bit
08-21 17:21:17.758 10478 10554 I python : Python for android ended.
Thanks for the reply!
I tried following the p4a documentation and buildozer documentation about recipes. I forked and cloned the p4a Github repo and modified the spec file as follows:
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
p4a.source_dir = ~/Desktop/python-for-android
I then created the following directory: Desktop/python-for-android/pythonforandroid/recipes/dlib
Under that directory, I created the following recipe, named __init__.py
:
from pythonforandroid.toolchain import Recipe
class DlibRecipe(Recipe):
name = 'dlib'
version = '1.0'
url = 'http://dlib.net/files/dlib-19.4.tar.bz2'
def prebuild_arch(self, arch):
super(DlibRecipe, self).prebuild_arch(arch)
# Do any pre-initialisation
def build_arch(self, arch):
super(DlibRecipe, self).build_arch(arch)
# Do the main recipe build
def postbuild_arch(self, arch):
super(DlibRecipe, self).build_arch(arch)
# Do any clearing up
recipe = DlibRecipe()
I'm not sure what else I'm supposed to include in the recipe, as I am struggling to understand the documentation. I have looked at other recipes in the repo and some of them are that simple. When I build my project, I get the following lines which seem to say my recipe is being used:
[INFO]: Of the existing distributions, the following meet the given requirements:
[INFO]: etsdemo: includes recipes (hostpython2, sdl2_image, sdl2_mixer, sdl2_ttf, python2, numpy, sdl2, six, opencv, pyjnius, kivy, scikit-learn, scikit-image, imutils, scipy, dlib), built for archs (armeabi-v7a)
However, when I deploy the application to the tablet, I get the same error message:
08-22 14:47:49.731 20527 20599 I python : [INFO ] [OSC ] using <thread> for socket
08-22 14:47:49.736 20527 20599 I python : [INFO ] [Window ] Provider: sdl2
08-22 14:47:49.743 20527 20599 W linker : /data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/kivy/graphics/cgl_backend/cgl_glew.so: is missing DT_SONAME will use basename as a replacement: "cgl_glew.so"
08-22 14:47:49.743 20527 20599 W linker : /data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/kivy/graphics/cgl_backend/cgl_gl.so: is missing DT_SONAME will use basename as a replacement: "cgl_gl.so"
08-22 14:47:49.750 303 310 D IMGSRV : gralloc_device_alloc:1305: hnd=0x7e2cc15760 ID=48640 fd=45 ref=0 1536(1536)x2048-0x1 usage=0xb00 size=12582912(12582912) cache=0
08-22 14:47:49.750 20527 20599 D IMGSRV : gralloc_register_buffer:1583: hnd=0xe41ca8c0 ID=48640 fd=66 ref=1
08-22 14:47:49.753 20527 20599 I python : [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
08-22 14:47:49.753 20527 20599 I python : [INFO ] [GL ] Backend used <gl>
08-22 14:47:49.754 20527 20599 I python : [INFO ] [GL ] OpenGL version <OpenGL ES 3.2 build 1.7@4167538>
08-22 14:47:49.754 20527 20599 I python : [INFO ] [GL ] OpenGL vendor <Imagination Technologies>
08-22 14:47:49.754 20527 20599 I python : [INFO ] [GL ] OpenGL renderer <PowerVR Rogue GX6250>
08-22 14:47:49.754 20527 20599 I python : [INFO ] [GL ] OpenGL parsed version: 3, 2
08-22 14:47:49.754 20527 20599 I python : [INFO ] [GL ] Texture max size <8192>
08-22 14:47:49.754 20527 20599 I python : [INFO ] [GL ] Texture max units <16>
08-22 14:47:49.779 20527 20599 I python : [INFO ] [Shader ] fragment shader: <Success.>
08-22 14:47:49.787 20527 20599 I python : [INFO ] [Shader ] vertex shader: <Success.>
08-22 14:47:49.789 20527 20599 I python : [INFO ] [Window ] auto add sdl2 input provider
08-22 14:47:49.790 20527 20599 I python : [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
08-22 14:47:49.796 20527 20599 W linker : /data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/kivy/core/text/text_layout.so: is missing DT_SONAME will use basename as a replacement: "text_layout.so"
08-22 14:47:49.798 20527 20599 W linker : /data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/kivy/core/text/_text_sdl2.so: is missing DT_SONAME will use basename as a replacement: "_text_sdl2.so"
08-22 14:47:49.799 20527 20599 I python : [INFO ] [Text ] Provider: sdl2
08-22 14:47:49.817 20527 20599 I python : Traceback (most recent call last):
08-22 14:47:49.817 20527 20599 I python : File "/home/alexandre/Desktop/Demo/.buildozer/android/app/main.py", line 26, in <module>
08-22 14:47:49.817 20527 20599 I python : File "/home/alexandre/Desktop/Demo/.buildozer/android/app/kivyCam.py", line 17, in <module>
08-22 14:47:49.817 20527 20599 I python : File "/home/alexandre/Desktop/Demo/.buildozer/android/app/faceDetector.py", line 13, in <module>
08-22 14:47:49.818 20527 20599 I python : File "/home/alexandre/Desktop/Demo/.buildozer/android/platform/build/dists/etsdemo/private/lib/python2.7/site-packages/dlib/__init__.py", line 1, in <module>
08-22 14:47:49.818 20527 20599 I python : ImportError: dlopen failed: "/data/data/org.innodem.etsdemo/files/app/lib/python2.7/site-packages/dlib/dlib.so" is 64-bit instead of 32-bit
08-22 14:47:49.853 20527 20599 I python : Python for android ended.
Here is a link to the full log: https://www.dropbox.com/s/ydsp9ke93z0zd19/log_tablet_4.txt?dl=0
Hello,
Have you tried to build without all the libraries you put in your spec file, and add them one by one ? I think opencv and imutils make the app crash when launching on the phone. Also shouldn't it be opencv-python as we do pip install opencv-python ?
I am new to Python Kivy and I compiled the apk without any errors, but when I run it, it crashes after the loading screen. buildozer.spec:# This .spec config file tells Buildozer an app's requirements for being built.
#
[app]
title = DownTube
package.name = downtube.app
package.domain = org.downtube
source.dir = .
source.include_exts = py,png,jpg,kv,atlas
version = 0.1
requirements = python3,kivy==2.1.0,pytube==15.0.0,moviepy==1.0.3
presplash.filename = loading.png
presplash.scale = fill
icon.filename = logo.png
orientation = portrait
#
#
#
osx.kivy_version = 2.1.0
#
#
fullscreen = 0
android.permissions = INTERNET, WRITE_EXTERNAL_STORAGE
android.sdk = 29
android.arch
as we weren't supporting builds for multiple archs at the same time.android.archs = arm64-v8a, armeabi-v7a
android.allow_backup = True
#
#
p4a.bootstrap = sdl2
#
#
ios.kivy_ios_url = https://github.com/kivy/kivy-ios
ios.kivy_ios_branch = master
ios.ios_deploy_url = https://github.com/phonegap/ios-deploy
ios.ios_deploy_branch = 1.12.2
ios.codesign.allowed = false
display_image_url
and full_size_image_url
options.app_url
and full_size_image_url
options.app_url
and display_image_url
options.[buildozer]
log_level = 2
warn_on_root = 1
#
#
#
#
#
#
#
#
#
#
#
#
#
#
I can't run it with logcat because I'm in a virtual machine, I send it directly to the phone via WhatsApp and try it.
The application I am writing compiles correctly, but when I push it to a tablet and run it, it crashes as soon as it gets past the 'Loading' screen.
Here are my system specs:
The device I am trying to deploy to is an ASUS ZenPad 3s 10. I have turned on the developer options, but it is not rooted as it seems it is not possible at the moment. The tablet is running Android 7.0.
Here is my buildozer spec file:
And here is a link to the logcat log file: https://www.dropbox.com/s/wrciz1od52rb1xh/log_tablet.txt?dl=0