RedApparat / Fotoapparat

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

java.lang.IllegalArgumentException: FocusMode mode manual is not supported. Samsung Grand Prime #163

Closed sefaaycicek closed 6 years ago

sefaaycicek commented 6 years ago

Hi, I tried different methods with different devices. Camera starts successfully on Samsung Note 5 but it always crash on Samsung Grand Prime(Android 6.0).

This is create method. I set focus mode correctly.

private Fotoapparat createFotoapparat() {
        return Fotoapparat
                .with(this)
                .into(cameraView)
                .previewScaleType(ScaleType.CenterCrop)
                .lensPosition(back())
                .focusMode(firstAvailable(continuousFocusPicture(),autoFocus(),fixed()))
                .logger(loggers(
                        logcat(),
                        fileLogger(this)
                ))
                .cameraErrorCallback(new Function1<CameraException, Unit>() {
                    @Override
                    public Unit invoke(CameraException e) {
                        Toast.makeText(TestActivity.this, e.toString(), Toast.LENGTH_LONG).show();
                        return null;
                    }
                })
                .build();
    }

Crash log says that Focus mode manuel is not supported.

Also we tried to set configuration manually as below code.

        fotoapparat = createFotoapparat();
        fotoapparat.updateConfiguration(cameraConfiguration);

Configuration instance is here.

 private CameraConfiguration cameraConfiguration = CameraConfiguration
            .builder()
            .photoResolution(standardRatio(
                    highestResolution()
            )).focusMode(firstAvailable(
                    continuousFocusPicture(),
                    autoFocus(),
                    fixed()

            )).flash(firstAvailable(
                    autoRedEye(),
                    autoFlash(),
                    torch(),
                    off()
            )).previewFpsRange(highestFps())
            .sensorSensitivity(highestSensorSensitivity())
            .build();
Diolor commented 6 years ago

Hey @sefaaycicek, thanks for opening a separate issue again! Could you also please paste the exact stacktrace? It would help us a lot.

My assumption so far is that Samsung Grand Prime violates the possible values of the Android camera Api and also returns manual which is not in the expected set of values. Instead of crashing the app we can simply find a way to ignore this value, but let's check first the stacktrace

Diolor commented 6 years ago

I made a blind fix. Try 2.0.0-beta3 2.0.0-beta5, should work I think

Diolor commented 6 years ago

I will assume this fixed with 2.0.0-beta5. Feel free to comment if you have further problems