benjamindean / flutter_vibration

Handle vibration on iOS and Android in Flutter apps
229 stars 69 forks source link

java.lang.IllegalArgumentException: timing and amplitude arrays must be of equal length (timings.length=4, amplitudes.length=2) #69

Closed offline-first closed 2 years ago

offline-first commented 2 years ago
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PlatformException(error, timing and amplitude arrays must be of equal length (timings.length=4, amplitudes.length=2), null, java.lang.IllegalArgumentException: timing and amplitude arrays must be of equal length (timings.length=4, amplitudes.length=2)
    at android.os.VibrationEffect.createWaveform(VibrationEffect.java:256)
    at d.d.a.a.d(Unknown Source:74)
    at d.d.a.b.onMethodCall(Unknown Source:147)
    at f.a.c.a.j$a.a(Unknown Source:17)
    at io.flutter.embedding.engine.f.e.k(Unknown Source:18)
    at io.flutter.embedding.engine.f.e.l(Unknown Source:20)
    at io.flutter.embedding.engine.f.e.m(Unknown Source:0)
    at io.flutter.embedding.engine.f.c.run(Unknown Source:12)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
). Error thrown null.
       at StandardMethodCodec.decodeEnvelope(message_codecs.dart:607)
       at MethodChannel._invokeMethod(platform_channel.dart:167)
benjamindean commented 2 years ago

Can you, please, give any context? The error is quite clear. If it happens during calling vibrate without arguments - it's a bug, yeah. Otherwise, you'll have to fix it yourself.

benjamindean commented 2 years ago

According to the error, you have 4 timings and 2 amplitude values. Those arrays should be equal.

langhoangal commented 1 year ago

@benjamindean This line from the document cause error: Vibration.vibrate(pattern: [500, 1000, 500, 2000], intensities: [1, 255]); Obviously the amplitude was not provided, only the intensities.

quad2x1008 commented 1 year ago

any solution of this issue.