RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.81k stars 405 forks source link

IllegalArgumentException: Opened camera does not support the selected focus_mode options #298

Closed fm-eb closed 5 years ago

fm-eb commented 5 years ago

we got several crashes on our app with this crash log:

java.lang.IllegalArgumentException: Opened camera does not support the selected focus_mode options.
    at io.fotoapparat.parameter.provider.InitialParametersValidator.validateParameter(InitialParametersValidator.java:31)
    at io.fotoapparat.parameter.provider.InitialParametersValidator.validate(InitialParametersValidator.java:24)
    at io.fotoapparat.parameter.provider.InitialParametersProvider.initialParameters(InitialParametersProvider.java:54)
    at io.fotoapparat.routine.StartCameraRoutine.run(StartCameraRoutine.java:41)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:841)

Device info:

Android: 4.4.4
Android Build: KTU84P.J110HXXU0AQI5
Manufacturer: samsung
Model: SM-J110H
Thread: pool-47-thread-1-11036

Unfortunately there is nothing more I can provide. No line from our app was referenced in the crash and it seems to be a quick check if the focus_mode is supported or not.

dmitry-zaitsev commented 5 years ago

Could you please show how you initialize the Fotoapparat? Specifically, what focus modes do you provide (if any)?

fm-eb commented 5 years ago

sure, here's our init code:

return Fotoapparat
            .with(this)
            .into(cameraView)
            .previewScaleType(ScaleType.CenterCrop)
            .lensPosition(lensPos)
            .frameProcessor(new SampleFrameProcessor())
            .logger(loggers(
                    logcat(),
                    fileLogger(this)
            ))
            .cameraErrorCallback(e -> {
                Toast.makeText(SelfieActivity.this, e.toString(), Toast.LENGTH_LONG).show();
            })
            .build();

with

dmitry-zaitsev commented 5 years ago

It looks like that this crash happened on a pretty old version of the library. Please try to update and see if the issue still happens - there were several fixes around that in the past.