RedApparat / Fotoapparat

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

io.fotoapparat.exception.camera.UnsupportedConfigurationException: FocusMode configuration selector couldn't select a value. Supported parameters: #211

Closed aviontechnology closed 6 years ago

aviontechnology commented 6 years ago

I am try to run this project but faceing some issue with kotlin code. Please tell me how to solve this issue. thanks in advance:

E/Fotoapparat Example: Camera error: io.fotoapparat.exception.camera.UnsupportedConfigurationException: FocusMode configuration selector couldn't select a value. Supported parameters: [io.fotoapparat.parameter.FocusMode$Fixed@d4b4b9d] at io.fotoapparat.parameter.camera.provide.CameraParametersProviderKt.getCameraParameters(CameraParametersProvider.kt:158) at io.fotoapparat.hardware.Device.getCameraParameters$suspendImpl(Device.kt:145) at io.fotoapparat.hardware.Device.getCameraParameters(Device.kt) at io.fotoapparat.routine.camera.UpdateConfigurationRoutineKt$updateCameraConfiguration$1.doResume(UpdateConfigurationRoutine.kt:26) at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:54) at kotlinx.coroutines.experimental.DispatchTask.run(CoroutineDispatcher.kt:129) at kotlinx.coroutines.experimental.EventLoopBase.processNextEvent(EventLoop.kt:147) at kotlinx.coroutines.experimental.BlockingCoroutine.joinBlocking(Builders.kt:236) at kotlinx.coroutines.experimental.BuildersKt.runBlocking(Builders.kt:174) at kotlinx.coroutines.experimental.BuildersKt.runBlocking$default(Builders.kt:167) at io.fotoapparat.routine.camera.UpdateConfigurationRoutineKt.updateCameraConfiguration(UpdateConfigurationRoutine.kt:25) at io.fotoapparat.routine.camera.StartRoutineKt.start(StartRoutine.kt:44) at io.fotoapparat.routine.camera.StartRoutineKt.bootStart(StartRoutine.kt:26) at io.fotoapparat.Fotoapparat$start$1.invoke(Fotoapparat.kt:84) at io.fotoapparat.Fotoapparat$start$1.invoke(Fotoapparat.kt:34) at io.fotoapparat.concurrent.CameraExecutor$execute$future$1.call(CameraExecutor.kt:26) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) D/Fotoapparat: CameraDevice: getCapabilities$suspendImpl

Diolor commented 6 years ago

Your camera supports only Fixed focus mode but you don't have it in the list of selectors. Check firstAvailable in an example here

aviontechnology commented 6 years ago

Hello as per suggestion i use below code: https://github.com/Fotoapparat/Fotoapparat/wiki/Configuration-Kotlin but it start continues crashing. please tell me what to do ?

error is as per below

FATAL EXCEPTION: main Process: io.fotoapparat.sample, PID: 2272 java.lang.RuntimeException: Unable to start activity ComponentInfo{io.fotoapparat.sample/io.fotoapparat.sample.MainActivity}: kotlin.UninitializedPropertyAccessException: lateinit property fotoapparat has not been initialized at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2345) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2407) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1319) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5280) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758) Caused by: kotlin.UninitializedPropertyAccessException: lateinit property fotoapparat has not been initialized at io.fotoapparat.sample.MainActivity.onStart(MainActivity.kt:186) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236) at android.app.Activity.performStart(Activity.java:6238) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)

Diolor commented 6 years ago

You need to initialise your lateinit property