Open agreensh opened 6 years ago
https://github.com/clovisnicolas/flutter_lamp/issues/5#issuecomment-440597092
the problem is, that for android this library uses the deprecated android.hardware.Camera, which is only supported up to android sdk version 20 for higher versions using android.hardware.camera2 is recommendet on my side I tried to change the LampPlugin, and it compiles without errors, sadly the light still wont turn on
I wrote my own plugin which works.
I wrote my own plugin which works.
Care to share?
Care to share?
I've incorporated the lamp functionality in my "utils" plugin (so it has lots of other stuff), but I can share the code for the lamp/torch if you want. To be honest, it's very similar to the code in this plugin (except the iOS code is in Swift) - I think this plugin just needs re-creating with the latest version of Flutter (and republish), as it looks like there are issues in the Android project files, not the actual code.
Care to share?
I've incorporated the lamp functionality in my "utils" plugin (so it has lots of other stuff), but I can share the code for the lamp/torch if you want. To be honest, it's very similar to the code in this plugin (except the iOS code is in Swift) - I think this plugin just needs re-creating with the latest version of Flutter (and republish), as it looks like there are issues in the Android project files, not the actual code.
Please share.
I've tested this plugin on iOS 10.0.0 up to 12.1.1 and Android up to Oreo (on a Samsung) and Nougat (on a Motorola). Works for me.
I've tested this plugin on iOS 10.0.0 up to 12.1.1 and Android up to Oreo (on a Samsung) and Nougat (on a Motorola). Works for me.
Guide us on usage please. I'm used to installing packages from dart pub.
Put the 'torch' directory at the same level as your project, then in pubspec.yaml (of your project) add
torch:
path: ../torch
then in dart file where you want to use it
import 'package:torch/torch.dart';
Put the 'torch' directory at the same level as your project, then in pubspec.yaml (of your project) add
torch: path: ../torch
then in dart file where you want to use it
import 'package:torch/torch.dart';
@agreensh thanks for the contribution, for me the plugins works ok for android but in IOS I got this error:
` Xcode build done. 2.2s Failed to build iOS app Error output from Xcode build: ↳ BUILD FAILED Xcode's output: ↳ === BUILD TARGET torch OF PROJECT Pods WITH CONFIGURATION Debug === /Users/alks/Projects/torch/ios/Classes/TorchPlugin.m:2:9: fatal error: 'torch/torch-Swift.h' file not found
When i change the name of the file to torch.swift but the same error happen:
` ↳ BUILD FAILED Xcode's output: ↳ === BUILD TARGET torch OF PROJECT Pods WITH CONFIGURATION Debug === /Users/alks/Projects/torch/ios/Classes/TorchPlugin.m:2:9: fatal error: 'SwiftTorchPlugin-Swift.h' file not found
^~~~~~
1 error generated.`
Help appreciated ... Regards
@agreensh thanks again for your help! maybe you can help with this issue: https://github.com/rmtmckenzie/flutter_qr_mobile_vision/issues/55#issuecomment-448816074 your package works and turns on the flashlight but I get errors that possibly conflicts with another package. Any help is appreciated, thanks!
@agreensh does your plugin works with the camera opened?
Android Version 7.0 Samsung Galaxy S6 (model SM-G920F)
Error when using the plugin in my app
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)
Another error when building your example:
E/BoostFramework(24970): BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib64, /vendor/lib64]]