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

Using the camera crashes the app #369

Closed
sstoychev opened this issue Sep 20, 2017 · 1 comment
Closed

Using the camera crashes the app #369

sstoychev opened this issue Sep 20, 2017 · 1 comment

Comments

@sstoychev
Copy link

sstoychev commented Sep 20, 2017

I have kivy app and using plyer camera:

...
from plyer import camera
...
    def open_camera(self):
        self.dismiss_popup()

        # Take a picture and save at this location. After will call done() callback
        pics_dir = os.path.join(App.get_running_app().user_data_dir, 'pics')
        if not os.path.exists(pics_dir):
            os.makedirs(pics_dir)
        pic_name = os.path.join(pics_dir, 'main.jpg')
        camera.take_picture(pic_name, self.done)
        self.additional_info.text = pic_name

    def done(self, e):
        print(e)
...

When I click to open the camera the app crashes.

...
09-20 02:34:19.031  7285  7410 W PythonActivity: Accessing org.renpy.android.PythonActivity is deprecated and will be removed in a future version. Please switch to org.kivy.android.PythonActivity.
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: static jfieldID 0xb05b16c0 not valid for class java.lang.Class<org.renpy.android.PythonActivity>
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]     in call to GetStaticObjectField
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]     from int org.libsdl.app.SDLActivity.nativeInit(java.lang.Object)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410] "SDLThread" prio=5 tid=12 Runnable
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x12c514c0 self=0x9ed98400
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   | sysTid=7410 nice=0 cgrp=default sched=0/0 handle=0x9dd70930
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 5939062751 1246171278 5527 ) utm=533 stm=60 core=0 HZ=100
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   | stack=0x9dc6e000-0x9dc70000 stackSize=1038KB
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   native: #00 pc 00370cb1  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiPKcPNS_9ArtMethodEPv+160)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   native: #01 pc 00350327  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+150)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   native: #02 pc 0025a605  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+740)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   native: #03 pc 0025acdd  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+64)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   native: #04 pc 000fd0b1  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+32)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   native: #05 pc 00114991  /system/lib/libart.so (_ZN3art11ScopedCheck16CheckFieldAccessERNS_18ScopedObjectAccessEP8_jobjectP9_jfieldIDbNS_9Primitive4TypeE+452)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   native: #06 pc 001163b5  /system/lib/libart.so (_ZN3art8CheckJNI8GetFieldEPKcP7_JNIEnvP8_jobjectP9_jfieldIDbNS_9Primitive4TypeE+524)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   native: #07 pc 0011694f  /system/lib/libart.so (_ZN3art8CheckJNI20GetStaticObjectFieldEP7_JNIEnvP7_jclassP9_jfieldID+30)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   native: #08 pc 00039079  /data/data/net.dtl.facialarc/files/app/lib/python2.7/site-packages/jnius/jnius.so (???)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   at org.libsdl.app.SDLActivity.nativeInit(Native method)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   at org.libsdl.app.SDLMain.run(SDLActivity.java:936)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410]   at java.lang.Thread.run(Thread.java:818)
09-20 02:34:19.061  7285  7410 F art     : art/runtime/java_vm_ext.cc:410] 
09-20 02:34:19.075   764  2156 D NetlinkSocketObserver: NeighborEvent{elapsedMs=287270970, fd44:1c17:1800::1, [C04A00B6B6B6], RTM_NEWNEIGH, NUD_STALE}
09-20 02:34:19.294  7340  7606 V stateside: Scheduling command [com.yahoo.android.yconfig.internal.k@f93222e] on target control state [FETCHING]
09-20 02:34:19.295  7340  7372 I stateside: Machine was transitioned from control state [WAITING_NEXT_RETRY] to [FETCHING]
...
09-20 02:34:19.330  7285  7410 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 7410 (SDLThread)
09-20 02:34:19.330   255   255 I DEBUG   : property debug.db.uid not set; NOT waiting for gdb.
09-20 02:34:19.330   255   255 I DEBUG   : HINT: adb shell setprop debug.db.uid 100000
09-20 02:34:19.330   255   255 I DEBUG   : HINT: adb forward tcp:5039 tcp:5039
09-20 02:34:19.433   255   255 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-20 02:34:19.433   255   255 F DEBUG   : CM Version: '13.1.2-ZNH2KAS3P0-bacon'
09-20 02:34:19.433   255   255 F DEBUG   : Build fingerprint: 'oneplus/bacon/A0001:6.0.1/MHC19Q/ZNH2KAS3P0:user/release-keys'
09-20 02:34:19.433   255   255 F DEBUG   : Revision: '0'
09-20 02:34:19.433   255   255 F DEBUG   : ABI: 'arm'
09-20 02:34:19.433   255   255 F DEBUG   : pid: 7285, tid: 7410, name: SDLThread  >>> net.dtl.facialarc <<<
09-20 02:34:19.433   255   255 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367544): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367545): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367546): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367547): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367548): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367549): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367550): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367551): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367552): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367553): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367554): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367555): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367556): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367557): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367558): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367559): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367560): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367561): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367562): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367563): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367564): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367565): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367566): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367567): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367568): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367569): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367570): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367571): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367572): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.434   255   255 W debuggerd: type=1400 audit(0.0:367573): avc: denied { search } for name="net.dtl.facialarc" dev="mmcblk0p28" ino=254504 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
09-20 02:34:19.459   255   255 F DEBUG   : Abort message: 'art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: static jfieldID 0xb05b16c0 not valid for class java.lang.Class<org.renpy.android.PythonActivity>'
09-20 02:34:19.459   255   255 F DEBUG   :     r0 00000000  r1 00001cf2  r2 00000006  r3 00000000
09-20 02:34:19.459   255   255 F DEBUG   :     r4 9dd70980  r5 00000006  r6 9dd70930  r7 0000010c
09-20 02:34:19.459   255   255 F DEBUG   :     r8 b4bff398  r9 b4c6a800  sl 00000001  fp 00000001
09-20 02:34:19.459   255   255 F DEBUG   :     ip 00000000  sp 9dd68858  lr b6c6a4d1  pc b6c6cc34  cpsr 20070010
09-20 02:34:19.485   255   255 F DEBUG   : 
09-20 02:34:19.485   255   255 F DEBUG   : backtrace:
...

Device : OnePlus One
Android 6.0.1
I'm using buildozer vm with buildozer.spec:

$ egrep "^[^#]" buildozer.spec 
[app]
title = FacialArc
package.name = FacialArc
package.domain = net.dtl
source.dir = .
source.include_exts = py,png,jpg,kv,atlas
version = 0.1
requirements = kivy, plyer
orientation = all
osx.python_version = 3
osx.kivy_version = 1.9.1
fullscreen = 1
android.permissions = CAMERA, WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE
android.minapi = 13
android.arch = armeabi-v7a
[buildozer]
log_level = 1
warn_on_root = 1
build_dir = /build/FacialArc

running buildozer with:
$ buildozer -v android debug deploy run logcat

I'm attaching the full error:
kivy_plyer_camera_erorr.txt
and the full source code:

main.txt
just rename it to main.py

P.S
I've also tried to build it using android_old but it can't be build:
$ buildozer -v android_old debug deploy run logcat
android_old_error.txt


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@sstoychev
Copy link
Author

OK, I solved it:
in buildozer.spec I needed android requirement:
requirements = kivy, plyer, android

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants