creativecreatorormaybenot/wakelock

Message corrupted, Failed to handle message

Closed this issue · 7 comments

Got the below issue, I'm on flutter 3.3.0:

E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): Failed to handle message
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): java.lang.IllegalArgumentException: Message corrupted
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at io.flutter.plugin.common.StandardMessageCodec.readValueOfType(StandardMessageCodec.java:450)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:340)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at io.flutter.plugin.common.StandardMessageCodec.readValueOfType(StandardMessageCodec.java:424)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at io.flutter.plugin.common.StandardMessageCodec.readValue(StandardMessageCodec.java:340)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at io.flutter.plugin.common.StandardMessageCodec.decodeMessage(StandardMessageCodec.java:89)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:218)
[GETX] Instance "SongController" has been initialized
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:319)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at android.os.Handler.handleCallback(Handler.java:938)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at android.os.Looper.loopOnce(Looper.java:226)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at android.os.Looper.loop(Looper.java:313)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at android.app.ActivityThread.main(ActivityThread.java:8669)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at java.lang.reflect.Method.invoke(Native Method)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/BasicMessageChannel#dev.flutter.pigeon.WakelockApi.toggle(24941): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
E/flutter (24941): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
E/flutter (24941): #0      WakelockApi.toggle (package:wakelock_platform_interface/messages.dart:89:7)
E/flutter (24941): <asynchronous suspension>
E/flutter (24941): #1      MethodChannelWakelock.toggle (package:wakelock_platform_interface/method_channel_wakelock.dart:20:5)
E/flutter (24941): <asynchronous suspension>

Same issue here. I'm on Flutter 3.0.5. Does not happen after downgrading to 0.6.1+2.

Edit: I just saw, that is was an upgrade to 0.6.1+2 instead of a downgrade. I was using
wakelock:
as dependency without giving a version after that in the pubspec.yaml and for some reason that fetches version 0.4.0.
Changing it to
wakelock: ^0.6.0
fetches 0.6.2 and fixes the issue.

The fetching of version 0.4.0 seems related to the package win32. as this gets downgraded from 3.0.0 to 2.7.0 when using version 0.6.2 instead of 0.4.0 of wakelock

Confirmed @miracoli 's solution as working.

Still, I added the package few days ago using the flutter pub add wakelock command and it automatically assumed the version 0.4.0, therefore something is still wrong.

@marianhlavac Yesterday a new version of wakelock_windows was released. That should fix this issue (at least it did for me). Could you run flutter pub upgrade and check if the correct version gets pulled?

@creativecreatorormaybenot
This problem happens on Android as well.
Is there any updates?
This still happens on 0.6.2

Hi.
I had the same the problem. The issue was old version of the packages imported. I was using 0.4.0 version which was not successful, I upgraded the pack version to 0.6.0 now it works on my platform.

Same here. Solves when I update the version from 0.4.0 to 0.6.2.

I will soon discontinue this repository. Please use wakelock_plus: ^1.1.6 instead.