flutter_lamp icon indicating copy to clipboard operation
flutter_lamp copied to clipboard

Flashlight not working on Android

Open AlexBacich opened this issue 7 years ago • 6 comments

Flash isn't working. Tried to start on example - it gives an error:

E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): Failed to handle method call E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): java.lang.RuntimeException: getParameters failed (empty parameters) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at android.hardware.Camera.native_getParameters(Native Method) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at android.hardware.Camera.getParameters(Camera.java:2027) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at plugins.flutter.lamp.lamp.LampPlugin.turn(LampPlugin.java:63) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at plugins.flutter.lamp.lamp.LampPlugin.onMethodCall(LampPlugin.java:34) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:152) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at android.os.MessageQueue.next(MessageQueue.java:375) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at android.os.Looper.loop(Looper.java:225) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at android.app.ActivityThread.main(ActivityThread.java:6589) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(31729): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

AlexBacich avatar Aug 03 '18 11:08 AlexBacich

Same error happened.

adlanarifzr avatar Nov 02 '18 09:11 adlanarifzr

Same error.

E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): Failed to handle method call E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): java.lang.RuntimeException: getParameters failed (empty parameters) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at android.hardware.Camera.native_getParameters(Native Method) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at android.hardware.Camera.getParameters(Camera.java:1952) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at plugins.flutter.lamp.lamp.LampPlugin.turn(LampPlugin.java:63) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at plugins.flutter.lamp.lamp.LampPlugin.onMethodCall(LampPlugin.java:34) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at android.os.MessageQueue.next(MessageQueue.java:323) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at android.os.Looper.loop(Looper.java:136) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at android.app.ActivityThread.main(ActivityThread.java:6682) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) E/MethodChannel#github.com/clovisnicolas/flutter_lamp(14908): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

agreensh avatar Dec 03 '18 10:12 agreensh

I have tried to make the example code work on a Nexus 5 running Nougat (7.1.2) without any luck. I have granted my application permissions to use the camera without affecting the outcome. The flash is working as I can toggle it from the dropdown menu. However, when I run it on a Oneplus5 with Oreo I can make it work. Has anybody else encountered a similar problem?

The only outcome I get in the terminal is the initial check: I/flutter (16233): Device has flash ? true

I have specified version lamp: 0.0.6 as dependency.

markflarup avatar Jan 02 '19 15:01 markflarup

I have tried to make the example code work on a Nexus 5 running Nougat (7.1.2) without any luck. I have granted my application permissions to use the camera without affecting the outcome. The flash is working as I can toggle it from the dropdown menu. However, when I run it on a Oneplus5 with Oreo I can make it work. Has anybody else encountered a similar problem?

The only outcome I get in the terminal is the initial check: I/flutter (16233): Device has flash ? true

I have specified version lamp: 0.0.6 as dependency.

If you need a solution now, look at Issue #7 and follow use of torch.zip plugin.

agreensh avatar Jan 02 '19 16:01 agreensh

If you need a solution now, look at Issue #7 and follow use of torch.zip plugin.

I tried to make it work without any luck. I will try to document my steps to figure out where I went wrong. Thanks for the reply.

Just a thought: have you considered closing this issue?

markflarup avatar Jan 03 '19 07:01 markflarup

I haven't closed this issue as, even though I've worked around it, it is still an issue with this package (flutter_lamp).

agreensh avatar Jan 03 '19 09:01 agreensh