title: Error: Failed to create capture session
body: <p>I am using below code in order to capture image:</p>
  
  <pre><code>mCameraDevice.createCaptureSession(Arrays.asList(previewSurface, mImageReader.getSurface()), new CameraCaptureSession.StateCallback(){
              @Override
              public void onConfigured(CameraCaptureSession session) {
                  if(mCameraDevice == null){
                      return;
                  }
                  try{
                      mPreviewCaptureRequest = mPreviewCaptureRequestBuider.build();
                      mCameraCaptureSession = session;
                      mCameraCaptureSession.setRepeatingRequest(
                              mPreviewCaptureRequest,
                              mSessionCaptureCallback,
                              mBackgroundHandler
                      );
                  }catch(CameraAccessException e){
                      e.printStackTrace();
                  }
              }
  
              @Override
              public void onConfigureFailed(CameraCaptureSession session) {
                  Toast.makeText(getApplicationContext(), "create camera session failed!", Toast.LENGTH_SHORT).show();
              }
          }, null);
  </code></pre>
  
  <blockquote>
    <p>Error: Failed to create capture session</p>
  </blockquote>
  
  <p>In setup camera. I have:</p>
  
  <pre><code>Size largestImageSize = Collections.max(
                      Arrays.asList(map.getOutputSizes(ImageFormat.JPEG)),
                      new Comparator&lt;Size&gt;() {
      @Override
      public int compare(Size lhs, Size rhs) {
           return Long.signum(lhs.getWidth() * lhs.getHeight() - rhs.getWidth() * rhs.getHeight());
      }
  }
  );
  mImageReader = ImageReader.newInstance(largestImageSize.getWidth(), largestImageSize.getHeight(), ImageFormat.JPEG, 1);
  mImageReader.setOnImageAvailableListener(mOnImageAvailableListener, mBackgroundHandler);
  </code></pre>
  
  <p>Permissions:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-feature android:name="android.hardware.camera2.full" /&gt;
  </code></pre>
  
  <p>I think the problem is with getting surface from <code>mImageReader</code>. But, I don't know what to do here!</p>