camerakit.CameraView库崩溃了很多

时间:2017-05-08 10:58:17

标签: android camera

我正在使用相机视图库直接捕获图像。但是只要打开包含它的活动,它就会崩溃很多。首先我的代码是:

mCameraView.setCameraListener(new CameraListener() {
        @Override
        public void onPictureTaken(byte[] jpeg) {
            super.onPictureTaken(jpeg);
            // Create a bitmap

        }
    });

@Override
protected void onResume() {
    super.onResume();
    mCameraView.start();
}

@Override
protected void onPause() {
    mCameraView.stop();
    super.onPause();
}

    captureButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mCameraView.captureImage();
        }
    });

现在发生崩溃的主要原因不是在我点击任何按钮之后,而是在打开包含此按钮的活动的那一刻。 错误就像:

Fatal Exception: java.lang.RuntimeException: java.io.IOException: setPreviewTexture failed
       at com.flurgle.camerakit.Camera1.setupPreview(Camera1.java:333)
       at com.flurgle.camerakit.Camera1.start(Camera1.java:86)
       at com.flurgle.camerakit.CameraView$3.run(CameraView.java:216)
       at java.lang.Thread.run(Thread.java:818)
Caused by java.io.IOException: setPreviewTexture failed
       at android.hardware.Camera.setPreviewTexture(Camera.java)
       at com.flurgle.camerakit.Camera1.setupPreview(Camera1.java:330)
       at com.flurgle.camerakit.Camera1.start(Camera1.java:86)
       at com.flurgle.camerakit.CameraView$3.run(CameraView.java:216)
       at java.lang.Thread.run(Thread.java:818)

或者是:

Fatal Exception: java.lang.RuntimeException: setParameters failed
       at android.hardware.Camera.native_setParameters(Camera.java)
       at android.hardware.Camera.setParameters(Camera.java:1878)
       at com.flurgle.camerakit.Camera1.setFlash(Camera1.java:139)
       at com.flurgle.camerakit.Camera1.adjustCameraParameters(Camera1.java:376)
       at com.flurgle.camerakit.Camera1.openCamera(Camera1.java:317)
       at com.flurgle.camerakit.Camera1.start(Camera1.java:85)
       at com.flurgle.camerakit.CameraView$3.run(CameraView.java:216)
       at java.lang.Thread.run(Thread.java:818)

我在互联网上搜索,但看起来人们没有发现问题或者人们不使用它。无论如何,它让我很烦,很有帮助。 btw库是this one

0 个答案:

没有答案