title: Android 6.0 RuntimeException: Fail to connect to camera service
body: <p>An error occurred with my app which ran in Nexus5 (Android6.0).</p>
  
  <p>The error was</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Fail to connect to camera service</p>
  </blockquote>
  
  <p>I had added the permission to the AndroidManifest.xml.</p>
  
  <p>But the app is OK with another phone(Android5.1), and genymotion AVD(Android 4.0).</p>
  
  <p>The key code is below</p>
  
  <pre><code> @Override
  public void onResume() {
      super.onResume();
      try {
          mCamera = Camera.open();
      }catch (Exception e){
          Log.e(TAG,"open camera failed",e);
      }
  
  }
  </code></pre>