[Nexus 5 Q&A, Help & Troubleshooting] dekiomk:
Can't connect to camera error Nexus 5 Android 5.1

Hi gays, I am new here. I keep getting the ' can't connect to camera' error on my Nexus 5 Android 5.1, and I tried everything that is suggested here and it did not help. I turned off Face unlock, uninstall Viber and install again, cleared cache of the camera and force stop and everything else. Only help restart the device. I succeeded to catch the logcat with the error. Here is the logcat:

04-02 21:19:26.744 724-2687/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.google.android.GoogleCamera/com.android.camera.CameraLauncher bnds=[849,1532][1050,1784] (has extras)} from uid 10019 on display 0

04-02 21:19:26.747 724-2687/? V/WindowManager﹕ addAppToken: AppWindowToken{2498ae08 token=Token{83da7ab ActivityRecord{3a47c5fa u0 com.google.android.GoogleCamera/com.android.camera.CameraLauncher t32}}} to stack=1 task=32 at 0

04-02 21:19:26.751 724-819/? V/WindowManager﹕ Based on layer: Adding window Window{15bd6123 u0 Starting com.google.android.GoogleCamera} at 3 of 9

04-02 21:19:26.824 724-1360/? I/ActivityManager﹕ Start proc 22932:com.google.android.GoogleCamera/u0a42 for activity com.google.android.GoogleCamera/com.android.camera.CameraLauncher

04-02 21:19:26.837 1361-3270/? W/GsaThreadFactory﹕ Not creating another thread for Background Blocking because there are already 30

04-02 21:19:26.876 22932-22932/? W/ResourcesManager﹕ Asset path '/system/framework/com.google.android.camera2.jar' does not exist or contains no resources.

04-02 21:19:26.935 22932-22932/? W/CAM_Log﹕ Tag SessionStatsCollector is 2 chars longer than limit.

04-02 21:19:26.989 22932-22932/? I/CameraManagerGlobal﹕ getCameraService: Reconnecting to camera service

04-02 21:19:27.254 22932-22979/? I/CAM2PORT_AndCamAgntImp﹕ Opening camera 0 with camera1 API

04-02 21:19:27.266 193-1682/? W/AudioFlinger﹕ acquireAudioSessionId() unknown client 22932 for session 116

04-02 21:19:27.268 193-1682/? I/AwesomePlayer﹕ setDataSource_l(<no-scheme URI suppressed>)

04-02 21:19:27.289 193-1682/? W/AudioFlinger﹕ acquireAudioSessionId() unknown client 22932 for session 117

04-02 21:19:27.290 193-1682/? I/AwesomePlayer﹕ setDataSource_l(<no-scheme URI suppressed>)

04-02 21:19:27.301 193-1682/? I/Camera2ClientBase﹕ Camera 0: Opened. Client: com.google.android.GoogleCamera (PID 22932, UID 10042)

04-02 21:19:27.302 22932-22992/? W/CAM_PhotoData﹕ Zero dimension in ContentResolver for /storage/emulated/0/DCIM/Camera/IMG_20150402_180439.jpg:0x0

04-02 21:19:27.303 193-1682/? D/mm-camera-intf﹕ mm_camera_open: dev name = /dev/video1, cam_idx = 1

04-02 21:19:27.304 206-206/? I/mm-camera-sensor﹕ module_sensor_start_session:583 session 1

04-02 21:19:27.305 206-206/? E/mm-camera-sensor﹕ csiphy_open:126 VIDIOC_MSM_CSIPHY_IO_CFG failed

04-02 21:19:27.305 206-206/? E/mm-camera-sensor﹕ module_sensor_init_session:335 failed rc -1

04-02 21:19:27.306 206-206/? E/mm-camera-sensor﹕ sensor_close:2499 VIDIOC_MSM_SENSOR_CFG failed

04-02 21:19:27.306 206-206/? E/mm-camera-sensor﹕ module_sensor_init_session:500 failed

04-02 21:19:27.306 206-206/? E/mm-camera-sensor﹕ module_sensor_start_session:612 failed

04-02 21:19:27.306 206-206/? E/mm-camera-sensor﹕ module_sensor_start_session:617 failed

04-02 21:19:27.306 206-206/? E/mm-camera-sensor﹕ sensor_get_capabilities:1632 failed

04-02 21:19:27.306 206-206/? E/mm-camera-sensor﹕ module_sensor_query_mod:2421 failed rc -4

04-02 21:19:27.307 206-206/? E/mm-camera﹕ cpp_hardware_process_command:254: failed, subdev not opened

04-02 21:19:27.307 206-206/? E/mm-camera﹕ cpp_module_query_mod:268: failed

04-02 21:19:27.307 206-206/? E/mm-camera﹕ pproc_module_query_mod:1697] error in cpp query mod

04-02 21:19:27.307 206-206/? I/mm-camera-sensor﹕ module_module_set_session_data:2666 max delay 2 report dSelay 1

04-02 21:19:27.307 206-206/? E/mm-camera﹕ isp_set_session_data: Session could not be found!

04-02 21:19:27.307 206-206/? E/mm-camera﹕ cpp_module_get_params_for_session_id:178, failed, session_id=0x1

04-02 21:19:27.307 206-206/? E/mm-camera﹕ cpp_module_set_session_data:329, failed

04-02 21:19:27.307 206-206/? E/mm-camera﹕ pproc_module_set_session_data:1928] error in cpp set_session_data

04-02 21:19:27.307 206-206/? D/mm-camera﹕ module_faceproc_set_session_data:1836] Per frame control 2 1

04-02 21:19:27.307 206-206/? I/mm-camera-sensor﹕ module_sensor_stop_session:636 session 1

04-02 21:19:27.307 206-206/? E/mm-camera-sensor﹕ module_sensor_deinit_session:526 ref count 0

04-02 21:19:27.307 206-206/? E/mm-camera-sensor﹕ module_sensor_stop_session:664 failed

04-02 21:19:27.307 206-206/? E/mm-camera-sensor﹕ module_sensor_stop_session:669 failed

04-02 21:19:27.307 206-206/? I/mm-camera﹕ cpp_module_stop_session:462, info: stopping session 1 ...

04-02 21:19:27.307 206-206/? I/mm-camera﹕ cpp_module_stop_session:504, info: session 1 stopped.

04-02 21:19:27.307 206-206/? I/mm-camera﹕ c2d_module_stop_session:322, info: stopping session 1 ...

04-02 21:19:27.307 206-206/? I/mm-camera﹕ c2d_module_stop_session:361, info: session 1 stopped.

04-02 21:19:27.308 206-206/? E/mm-camera﹕ main: New session [1] creation failed with error

04-02 21:19:27.308 193-1682/? D/mm-camera-intf﹕ mm_camera_open: opened, break out while loop

04-02 21:19:27.308 193-1682/? E/mm-camera-intf﹕ mm_camera_open: cannot open control fd of '/dev/video1' (Bad address)

04-02 21:19:27.308 193-1682/? E/mm-camera-intf﹕ camera_open: mm_camera_open err = -1

04-02 21:19:27.308 193-1682/? E/QCamera3HWI﹕ camera_open failed.

04-02 21:19:27.308 193-1682/? E/Camera3-Device﹕ Camera 0: initialize: Could not open camera: No such device (-19)

04-02 21:19:27.308 193-1682/? E/Camera2ClientBase﹕ initialize: Camera 0: unable to initialize device: No such device (-19)

04-02 21:19:27.308 193-1682/? E/CameraService﹕ connectFinishUnsafe: Could not initialize client from HAL module.

04-02 21:19:27.308 193-1682/? I/Camera2Client﹕ Camera 0: Closed

04-02 21:19:27.309 193-1682/? I/Camera2ClientBase﹕ Closed Camera 0. Client was: com.google.android.GoogleCamera (PID 22932, UID 10042)

04-02 21:19:27.313 193-1682/? W/AudioFlinger﹕ session id 116 not found for pid 22932

04-02 21:19:27.317 193-1682/? W/AudioFlinger﹕ session id 117 not found for pid 22932

04-02 21:19:27.318 22932-22979/? W/CameraBase﹕ An error occurred while connecting to camera: 0

04-02 21:19:27.318 22932-22979/? E/CAM2PORT_AndCamAgntImp﹕ RuntimeException during CameraAction[OPEN_CAMERA] at CameraState[1]

java.lang.RuntimeException: Fail to connect to camera service

at android.hardware.Camera.<init>(Camera.java:497)

at android.hardware.Camera.open(Camera.java:342)

at com.android.ex.camera2.portability.AndroidCameraAgentImpl$CameraHandler.handleMessage(AndroidCameraAgentImpl.java:370)

at android.os.Handler.dispatchMessage(Handler.java:102)

at android.os.Looper.loop(Looper.java:135)

at android.os.HandlerThread.run(HandlerThread.java:61)

04-02 21:19:27.371 22932-23015/? D/OpenGLRenderer﹕ Use EGL_SWAP_BEHAVIOR_PRESERVED: true

04-02 21:19:27.377 22932-22932/? D/Atlas﹕ Validating map...

04-02 21:19:27.381 724-1360/? V/WindowManager﹕ Adding window Window{312f9c81 u0 com.google.android.GoogleCamera/com.android.camera.CameraLauncher} at 3 of 10 (before Window{15bd6123 u0 Starting com.google.android.GoogleCamera})

04-02 21:19:27.387 22932-22932/? W/CAM_CameraActivity﹕ Camera open failure: HIST_ID0_-1_1_HEND

04-02 21:19:27.387 22932-22932/? E/CAM_Util﹕ Show fatal error dialog

04-02 21:19:27.402 724-2689/? V/WindowManager﹕ Adding window Window{302ae167 u0 com.google.android.GoogleCamera/com.android.camera.CameraLauncher} at 4 of 11 (before Window{15bd6123 u0 Starting com.google.android.GoogleCamera})

04-02 21:19:27.406 22932-22932/? D/WearableClient﹕ WearableClientImpl.onPostInitHandler: done

04-02 21:19:27.431 22932-23015/? I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 01/14/15, ab0075f, Id3510ff6dc

04-02 21:19:27.432 22932-23015/? I/OpenGLRenderer﹕ Initialized EGL, version 1.4

04-02 21:19:27.444 22932-23015/? D/OpenGLRenderer﹕ Enabling debug mode 0

04-02 21:19:27.487 22932-22932/? I/CAM_UsageStats﹕ PlayLogger.onLoggerConnected

04-02 21:19:27.512 724-2689/? D/WifiService﹕ acquireWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@1d85b024}

04-02 21:19:27.516 22932-22932/? I/CAM_PhotoModule﹕ onPreviewUIReady

04-02 21:19:27.516 22932-22932/? I/CAM_PhotoModule﹕ attempted to start preview before camera device

04-02 21:19:27.518 724-851/? E/WifiStateMachine﹕ WifiStateMachine CMD_START_SCAN source 10007 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=10:fe:ed:4e:a3:ae RSSI=-47

04-02 21:19:27.574 724-819/? I/ActivityManager﹕ Displayed com.google.android.GoogleCamera/com.android.camera.CameraLauncher: +790ms

Please HELP, it's really annoying :(

Best regards.