title: Android Camera: Failed to connect to service
body: <p>I am trying to develop a face tracking app using the Google Vision API (<a href="https://developers.google.com/android/reference/com/google/android/gms/vision/package-summary" rel="nofollow">API doc</a>)</p>
  
  <p><br>This is my manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.CAMERA"/&gt;
  &lt;uses-feature android:name="android.hardware.camera.front" android:required="true"/&gt;
  &lt;meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="face"&gt;&lt;/meta-data&gt;
  
      *activities*
  </code></pre>
  
  <p><br>This is my code:</p>
  
  <pre><code>private void startCameraSource() {
      try {
          mCameraSource.start(mPreviewHolder);
      } catch (IOException e) {
          //Error handling
          Toast.makeText(this, "Could not start camera!", Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p><br>This is the error in Logcat:</p>
  
  <pre><code>Caused by: java.lang.RuntimeException: Fail to connect to camera service
  E/AndroidRuntime:     at android.hardware.Camera.&lt;init&gt;(Camera.java:520)
  E/AndroidRuntime:     at android.hardware.Camera.open(Camera.java:361)
  E/AndroidRuntime:     at com.google.android.gms.vision.CameraSource.zzEu(Unknown Source)
  E/AndroidRuntime:     at com.google.android.gms.vision.CameraSource.start(Unknown Source)
  </code></pre>
  
  <p><br>Why does this happen (...on an Xperia Z3 compact 5.1)?</p>
  
  <p><br>
  <strong>UPDATE:</strong></p>
  
  <p>I spotted a new error. I think it might be the reason why my code is not working.<br> How can I resolve this problem?</p>
  
  <pre><code>W/ServiceManager: Permission failure: android.permission.CAMERA from uid=10241 pid=26845
  E/CameraService: Permission Denial: can't use the camera pid=26845, uid=10241
  </code></pre>