Access camera/photos

That’s the first time when you start the debugger. It has nothing to do with Defold.

Did you get an error/callstack?

No, it works when i start it from the terminal, so no error there, but when i try to start it from defold i only get this

i also tried to bundle for Android and install it on a Android(10) phone, the extension camera project, but it crashes there as well?

And did you get any info from the crash? Look in the logcat

dont know how to do that… can you run the camera example on an android phone?

I’ve done some tests with the example project on macOS Catalina and I get the same crash when doing Project->Build from the editor. If I bundle and run the .app it works. An iOS application bundle works. And an Android bundle as well.

I vaguely recall something camera related in the past when running from the editor. I think the spawned build somehow inherits some kind of config/settings from the editor.

1 Like

ok, but what can i do about it crashing on android? can i se some logout messages or something when running on the android device? am i bundeling it wrong, is that why it crashes for me and not you?

then i install it like this

Create a debug build and run adb logcat:

there is nothing printed out in logcat when i try to open the camera project, the program just quits to the phone desktop…
I am getting other printouts in logcat before, so logcat is working!

What are the next few entries after it stops working? logcat should at least show the reason that the app is terminated.

no this is the last rows, i was suprised to!? this is all the output when i start the project until it crash

Do not filter the log on only log entries coming from Defold. I’m sure there’s a clue to why it crashed in the full log.

ah, yes, there is alot of things there when i dont filter… do you have any suggestions of what i can filter on?

something here maybe? this is without a filter…

11-19 07:48:37.026  2881  2911 D CodecSolution: isMaxAspectPackageEx: com.sec.android.app.launcher : true(2)
11-19 07:48:37.041   507   507 I SurfaceFlinger: Display 0 HWC layers:
11-19 07:48:37.041   507   507 I SurfaceFlinger:     type    |    handle    | flag |  format   |   source crop (l,t,r,b)    |         frame       | name 
11-19 07:48:37.041   507   507 I SurfaceFlinger: ------------+--------------+------+-----------+----------------------------+---------------------+------
11-19 07:48:37.041   507   507 I SurfaceFlinger:      CLIENT | 0x7371085980 | 0002 | RGBA_8888 |   0.0    0.0  720.0 1480.0 |    0    0  720 1480 | com.android.systemui.ImageWallpaper$_3263#0
11-19 07:48:37.041   507   507 I SurfaceFlinger:      CLIENT | 0x737064d940 | 0000 | RGBA_8888 |   0.0    0.0  720.0 1480.0 |    0    0  720 1480 | com.sec.android.app.launcher/com.sec[...]ties.LauncherActivity$_3476#0 (Blur)
11-19 07:48:37.041   507   507 I SurfaceFlinger:      DEVICE | 0x738eeaee80 | 0000 | RGBA_8888 |   0.0   34.0  720.0   42.0 |    0    0  720    8 | StatusBar$_3263#0
11-19 07:48:37.041   507   507 I SurfaceFlinger:      DEVICE | 0x738eeabb40 | 0000 | RGBA_8888 |   0.0    0.0   67.0  284.0 |    0  180   67  464 | com.samsung.android.app.cocktailbars[...]arservice.CocktailBarService$_7560#0
11-19 07:48:37.041   507   507 I SurfaceFlinger:      DEVICE | 0x738eeada80 | 0000 | RGBA_8888 |   0.0    0.0  720.0   84.0 |    0 1396  720 1480 | NavigationBar0$_3263#0
11-19 07:48:37.041   507   507 I SurfaceFlinger: 
11-19 07:48:37.056  2612  1321 I Camera3-Device: disconnectImpl: E
11-19 07:48:37.056  2612  1321 D Camera3-Device: disconnectImpl: mInterfaceLock.lock()
11-19 07:48:37.056  2612  1321 D Camera3-Device: disconnectImpl: mInterfaceLock.unlock()
11-19 07:48:37.056  2612  1321 D Camera3-Device: disconnectImpl: mInterfaceLock.lock()
11-19 07:48:37.056  2612  1321 D Camera3-Device: CameraPerf: close E
11-19 07:48:37.056   491  2574 I ExynosCameraInterface: INFO(HAL3_camera_device_close[241]):in =====
11-19 07:48:37.056   491  2574 D ExynosCameraInterface: [m_resetMultiDeviceCamId : 703] camera (0) is closed at idx (0, 1)
11-19 07:48:37.056   491  2574 D ExynosCameraSec: [CAM_ID(0)][Back_0]-DEBUG(releaseDevice[673]):
11-19 07:48:37.056   491  2574 D ExynosCameraUtils: DEBUG(setPreviewProperty[2599]):Set persist.sys.camera.preview 0
11-19 07:48:37.073  2881  2881 D CustomFrequencyManagerService: releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT  frequency : 1794000  uid : 1000  pid : 2881  tag : AMS_RESUME_TAIL@CPU_MIN@33
11-19 07:48:37.084   491  2574 D ExynosCameraSec: [CAM_ID(0)][Back_0]-DEBUG(releaseDevice[701]):Deinit Buffer Supplier Thread created
11-19 07:48:37.084   491 28936 D ExynosCameraFrameManager: [CAM_ID(0)][CREATE FRAME WORKER]-DEBUG(workerMain[405]): Create worker stopped delete current frame(300)
11-19 07:48:37.084   491 28936 D ExynosCameraFrameManager: DEBUG(release):Remained item 300 will be deleted
11-19 07:48:37.094   491  2574 D ExynosCameraFrameManager: [CAM_ID(0)][CREATE FRAME WORKER]-DEBUG(stop[279]): worker stopped remove ths remained frames(0)
11-19 07:48:37.094   491 28937 I ExynosCameraFrameManager: [CAM_ID(0)][RUNNING FRAME WORKER]-INFO(workerMain[945]): wait and pop fail, ret(-110)
11-19 07:48:37.094   491  2574 D ExynosCameraFrameManager: [CAM_ID(0)][RUNNING FRAME WORKER]-DEBUG(stop[779]): worker stopped remove ths remained frames(0) queue(0)
11-19 07:48:37.094   491  2574 D ExynosCameraFrameManager: [CAM_ID(0)][RUNNING FRAME WORKER]-DEBUG(dump[818]): No memory leak detected m_runningFrameList.size()(0)
11-19 07:48:37.094   491  2574 D ExynosCameraInterface: DEBUG(check_camera_state):camera(0) state(3) checking...
11-19 07:48:37.094   491  2574 D ExynosCameraInterface: DEBUG(check_camera_state):camera(0) state(1:OPENED->3:CLOSED) is valid
11-19 07:48:37.094   491  2574 I ExynosCamera: [CAM_ID(0)][Back_0]-INFO(release[612]):-IN-
11-19 07:48:37.094   491  2574 I ExynosCameraSec: [CAM_ID(0)][Back_0]-INFO(m_vendorSpecificPreDestructor[305]):-IN-
11-19 07:48:37.094   491  2574 I SecCameraUtil: INFO(isEEprom[138]): SAMSUNG_EEPROM_REAR is not defined
11-19 07:48:37.095   491  2574 I ExynosCameraSec: [CAM_ID(0)][Back_0]-INFO(m_vendorSpecificPreDestructor[405]):-OUT-
11-19 07:48:37.095   491  2574 I ExynosCamera: [CAM_ID(0)][Back_0]-INFO(m_deinitFrameFactory[2609]):-IN-
11-19 07:48:37.095   491  2574 I ExynosCamera: [CAM_ID(0)][Back_0]-INFO(m_deinitFrameFactory[2646]):-OUT-
11-19 07:48:37.095   491  2574 D ExynosCamera: DEBUG:duration time(    0 msec):(m_deinitFrameFactory)
11-19 07:48:37.095   491  2574 D ExynosCameraStreamManager: DEBUG(~ExynosCameraStreamManager[310]):
11-19 07:48:37.095   491  2574 D ExynosCameraStreamManager: DEBUG(m_deinit[329]):ID(0)
11-19 07:48:37.095   491  2574 D RefBase : RefBase: Explicit destruction, weak count = 0 (in 0xf2548640)
11-19 07:48:37.095   491  2574 W RefBase : CallStack::getCurrentInternal not linked, returning null
11-19 07:48:37.095   491  2574 W RefBase : CallStack::logStackInternal not linked
11-19 07:48:37.095   491  2574 D ExynosCameraRequestManager: [CAM_ID(0)][]-DEBUG(~ExynosCameraRequestManager[1304]):
11-19 07:48:37.095   491 28959 I ExynosCameraSec: [CAM_ID(0)][Back_0]-INFO(m_sensorListenerUnloadThreadFunc[512]):-IN-
11-19 07:48:37.095   491  2574 D RefBase : RefBase: Explicit destruction, weak count = 0 (in 0xf2519b04)
11-19 07:48:37.095   491  2574 W RefBase : CallStack::getCurrentInternal not linked, returning null
11-19 07:48:37.095   491 28959 I ExynosCameraSec: [CAM_ID(0)][Back_0]-INFO(m_sensorListenerUnloadThreadFunc[580]):-OUT-
11-19 07:48:37.095   491  2574 W RefBase : CallStack::logStackInternal not linked
11-19 07:48:37.095   491  2574 D RefBase : RefBase: Explicit destruction, weak count = 0 (in 0xf247fac0)
11-19 07:48:37.095   491  2574 W RefBase : CallStack::getCurrentInternal not linked, returning null
11-19 07:48:37.095   491  2574 W RefBase : CallStack::logStackInternal not linked
11-19 07:48:37.095   491  2574 I ExynosCameraSec: [CAM_ID(0)][Back_0]-INFO(m_vendorSpecificDestructor[412]):-IN-
11-19 07:48:37.095   491  2574 I ExynosCameraSec: [CAM_ID(0)][Back_0]-INFO(m_vendorSpecificDestructor[504]):-OUT-
11-19 07:48:37.095   491  2574 D ExynosCameraFrameManager: [CAM_ID(0)][FRAME MANAGER]-DEBUG(~ExynosCameraFrameManager[1103]): FrameManager DELETE mode(2)
11-19 07:48:37.095   491  2574 D ExynosCameraFrameManager: [CAM_ID(0)][CREATE FRAME WORKER]-DEBUG(~CreateWorker[147]): Worker DELETE mode(2) 
11-19 07:48:37.095   491  2574 D ExynosCameraFrameManager: DEBUG(release):Remained item 1 will be deleted
11-19 07:48:37.095   491  2574 D ExynosCameraFrameManager: [CAM_ID(0)][CREATE FRAME WORKER]-DEBUG(m_setMargin[112]):margin is updated, margin[MAX/MIN]=(300 x 200) -> (200 x 100)
11-19 07:48:37.095   491  2574 D ExynosCameraFrameManager: [CAM_ID(0)][RUNNING FRAME WORKER]-DEBUG(~RunWorker[661]): Worker DELETE mode(2) 
11-19 07:48:37.095   491  2574 D ExynosCameraFrameManager: [CAM_ID(0)][FRAME MANAGER]-DEBUG(m_deinit[1383]): delete m_keybox
11-19 07:48:37.095   491  2574 I ExynosCamera: [CAM_ID(0)][Back_0]-INFO(release[783]):-OUT-
11-19 07:48:37.095   491  2574 I ExynosCameraInterface: INFO(HAL3_camera_device_close[290]):close camera(0)
11-19 07:48:37.095   491  2574 I ExynosCameraInterface: INFO(HAL3_camera_device_close[303]):out =====
11-19 07:48:37.095   491  2574 D ExynosCameraInterface: DEBUG:duration time(   39 msec):(HAL3_camera_device_close)
11-19 07:48:37.095  2612  1321 D Camera3-Device: CameraPerf: close X
11-19 07:48:37.095  2612  1321 I Camera3-Device: disconnectImpl: X
11-19 07:48:37.095  2612  1321 D Camera3-Device: disconnectImpl: mInterfaceLock.unlock()
11-19 07:48:37.095  2612  1321 D CameraService: BasicClient::disconnect E
11-19 07:48:37.096  2612  2715 I Camera3-Device: disconnectImpl: E
11-19 07:48:37.096  2612  2715 D Camera3-Device: disconnectImpl: mInterfaceLock.lock()
11-19 07:48:37.096  2612  2715 D Camera3-Device: disconnectImpl: mInterfaceLock.unlock()
11-19 07:48:37.096  2612  1321 I CameraService: finishCameraOps: Finish camera ops, package name = com.defold.camera, client UID = 10428
11-19 07:48:37.097  2612  1321 I CameraService: service.camera.running set to 0
11-19 07:48:37.097  2612  1321 I CameraService: onTorchStatusChangedLocked: Torch status changed for cameraId=0, newStatus=1
11-19 07:48:37.097  2612  1321 I CameraService: updateProxyDeviceState: notifyCameraState for Camera ID 0,  newState 3, facing 0, clientName com.defold.camera, apiLevel 1
11-19 07:48:37.097  3263  5219 I CameraManagerGlobal: postSingleTorchUpdate device: camera id 0 status 1
11-19 07:48:37.097  4937  9273 I CameraManagerGlobal: postSingleUpdate device: camera id 0 status STATUS_PRESENT
11-19 07:48:37.097  3263  3778 I CameraManagerGlobal: onTorchModeChanged
11-19 07:48:37.097  4937  9273 I CameraManagerGlobal: Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.defold.camera API Level 1
11-19 07:48:37.097  3263  5219 I CameraManagerGlobal: Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.defold.camera API Level 1
11-19 07:48:37.097 27704 27721 I CameraManagerGlobal: Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.defold.camera API Level 1
11-19 07:48:37.097  3263  3778 V Tile History: Flashlight ::StateLogger[action=refresh,state=1,value=false,isTransient=false,when= 11-19 07:48:37.097,extra=AvailabilityChanged:true]
11-19 07:48:37.097 30221 13292 I CameraManagerGlobal: Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.defold.camera API Level 1
11-19 07:48:37.098 24855 24872 I CameraManagerGlobal: Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.defold.camera API Level 1
11-19 07:48:37.098  2881  5835 D SettingsProvider: isChangeAllowed() : name = flashlight_available
11-19 07:48:37.098  2881  5835 D SettingsProvider: edmUri: content://com.sec.knox.provider/RestrictionPolicy3
11-19 07:48:37.098  2612  1321 I CameraFlashlight: deviceClosed: device 0 is closed, need to skip = 0
11-19 07:48:37.098  2881  5835 D SettingsProvider: projectionArgs: isSettingsChangesAllowed
11-19 07:48:37.098  2881  5835 D SettingsProvider: selectionArgs: false
11-19 07:48:37.098  2612  1321 I CameraService: onTorchStatusChangedLocked: Torch status changed for cameraId=0, newStatus=1
11-19 07:48:37.098  2881  5835 D SettingsProvider: selectionArgs: 10005
11-19 07:48:37.098  2612  1321 I CameraService: disconnect: Disconnected client for camera 0 for PID 28715
11-19 07:48:37.098  2612  1321 D CameraService: BasicClient::disconnect X
11-19 07:48:37.098  2612  1321 I Camera2Client: Camera 0: Closed
11-19 07:48:37.098  2612  1321 D CameraService: BasicClient::disconnect E
11-19 07:48:37.098  2612  1321 D CameraService: BasicClient::disconnect X - already disconnected
11-19 07:48:37.098  2881  5835 D SecContentProvider: query(), uri = 17 selection = isSettingsChangesAllowed
11-19 07:48:37.098  2612  1321 I Camera2ClientBase: Closed Camera 0. Client was: com.defold.camera (PID 28715, UID 10428)
11-19 07:48:37.098  2612  1321 D CameraService: BasicClient::disconnect E
11-19 07:48:37.098  2612  1321 D CameraService: BasicClient::disconnect X - already disconnected
11-19 07:48:37.098  2881  5835 D SecContentProvider: called from android.uid.systemui:10005
11-19 07:48:37.098  2612  1321 E CameraService: binderDied: Java client's binder died, removing it from the list of active clients
11-19 07:48:37.098  2881  5835 D RestrictionPolicy: isSettingsChangesAllowedAsUser, userId 0 : true
11-19 07:48:37.098  2881  5835 D SettingsProvider: ret = 1
11-19 07:48:37.098  2881  5835 I GenerationRegistry: mBackingStore.isClosed() : false
11-19 07:48:37.099  2881  5835 D SettingsProvider: isChangeAllowed() : name = flashlight_enabled
11-19 07:48:37.099  2881  5835 D SettingsProvider: edmUri: content://com.sec.knox.provider/RestrictionPolicy3
11-19 07:48:37.099  2881  5835 D SettingsProvider: projectionArgs: isSettingsChangesAllowed
11-19 07:48:37.099  2881  5835 D SettingsProvider: selectionArgs: false
11-19 07:48:37.099  2881  5835 D SettingsProvider: selectionArgs: 10005
11-19 07:48:37.099  2881  5835 D SecContentProvider: query(), uri = 17 selection = isSettingsChangesAllowed
11-19 07:48:37.099  2881  5835 D SecContentProvider: called from android.uid.systemui:10005
11-19 07:48:37.099  2881  5835 D RestrictionPolicy: isSettingsChangesAllowedAsUser, userId 0 : true
11-19 07:48:37.099  2881  5835 D SettingsProvider: ret = 1
11-19 07:48:37.100  4833  4833 D DMASA[S]: [CFLogReceiver]Receive broadcast(4K3-399-1014897): com.sec.android.diagmonagent.intent.USE_APP_FEATURE_SURVEY
11-19 07:48:37.100  2881  2881 V SettingsProvider: Notifying for 0: content://settings/secure/flashlight_available
11-19 07:48:37.100  4833  4833 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1632 android.content.ContextWrapper.startService:683 android.content.ContextWrapper.startService:683 com.sec.android.diagmonagent.sa.receiver.CFLogReceiver.sendCFLog:26 com.sec.android.diagmonagent.sa.receiver.CFLogReceiver.onReceive:18 
11-19 07:48:37.159  2881  3288 D MdnieScenarioControlService:  packageName : com.sec.android.app.launcher    className : com.android.launcher3.Launcher
11-19 07:48:37.159  2881  3288 V MdnieScenarioControlService: setUIMode from UI function(3)
11-19 07:48:37.165 27313 28950 I BatteryStatsManager: weekly result.size() : 7

Capture a full log and provide it as a zip file. In the log I’d like to see all of the Defold stuff (from your screenshot above) and anything that comes after it until the app shuts down. So a few seconds of logs should be enough. You can attach the log as a zip file here.

here is a log when starting camera project and it closes directly, i do se the defold image for half a second before it closes tho…
camera_log3.txt.zip (1.2 MB)

Here we go:

11-19 11:17:43.361 23141 23141 D AndroidRuntime: Shutting down VM
--------- beginning of crash
11-19 11:17:43.366 23141 23141 E AndroidRuntime: FATAL EXCEPTION: main
11-19 11:17:43.366 23141 23141 E AndroidRuntime: Process: com.defold.camera, PID: 23141
11-19 11:17:43.366 23141 23141 E AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:android:fragment:0, request=100, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.defold.camera/com.dynamo.android.DefoldActivity}: java.lang.RuntimeException: setParameters failed
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5360)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:5401)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:107)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:237)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8167)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: Caused by: java.lang.RuntimeException: setParameters failed
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.hardware.Camera.native_setParameters(Native Method)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.hardware.Camera.setParameters(Camera.java:2117)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at com.defold.android.camera.AndroidCamera.startPreviewAuthorized(AndroidCamera.java:155)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at com.defold.android.camera.AndroidCamera.onRequestPermissionsResult(AndroidCamera.java:83)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.Activity.dispatchRequestPermissionsResultToFragment(Activity.java:8492)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.Activity.dispatchActivityResult(Activity.java:8308)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5353)
11-19 11:17:43.366 23141 23141 E AndroidRuntime: 	... 11 more
11-19 11:17:43.377  2842 32661 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
11-19 11:17:43.382  2842  5579 D Debug   : !@DumpState : SHIP
11-19 11:17:43.382  2842  5579 D Debug   : !@DumpState : debug level:0x4f4c
11-19 11:17:43.382  2842  5579 D Debug   : !@Dumpstate : Finally, system will skip dumpstate
11-19 11:17:43.385  2842  5579 W ActivityManager: crash : com.defold.camera,0
11-19 11:17:43.392  2842  5579 W ActivityTaskManager:   Force finishing activity com.defold.camera/com.dynamo.android.DefoldActivity

We have to take a look at this bit of code to understand why it’s crashing.

1 Like

@geidnert we need your help testing this. May I suggest that you start by removing all of these lines:

With this we do not set any camera parameters at all, and I’d expect the camera to at least start, but perhaps the preview isn’t quite right or something like that.

And then gradually I’d suggest that you add arguments back, starting with for instance setPreviewSize and setPictureSize. My guess is that it is either setPictureFormat or setFocusMode that is the problem.

Once we’ve figured out what’s wrong we should make sure to catch that exception so that the entire app doesn’t crash.

1 Like

anyone of these 3 marked lines uncommented make it crash

image

when they are commented away the screen looks like this

2 Likes

Which device are you using? Model and Android OS version.

Samsung Galaxy S9+ , One UI-version 2.5, Android-version 10.