How to fix “Fail to connect to camera service” exception in Android emulator

前端 未结 8 1692
情书的邮戳
情书的邮戳 2020-12-01 06:35

I\'m getting a Fail to connect to camera service exception when I run my Android app in the emulator. I\'ve read the various existing posts but none have fixed this. It is

8条回答
  •  再見小時候
    2020-12-01 06:58

    If you are using surface View and using code like this`

     Observable.create(CameraUtils.getCameraOnSubscribe())
                        .subscribeOn(Schedulers.newThread())
                        .observeOn(AndroidSchedulers.mainThread())
                        .subscribe(camera -> {
    
                     mCamera = camera.open();
    ...    
    }};
    

    Then replace mCamera=camera;

提交回复
热议问题