fluttercommunity / wakelock_plus

Flutter plugin that allows you to keep the device screen awake on Android, iOS, macOS, Windows, Linux, and web.
BSD 3-Clause "New" or "Revised" License
71 stars 54 forks source link

Exception thrown when trying to enable or disable wakelock #37

Open arabnology opened 8 months ago

arabnology commented 8 months ago

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null) -0 WakelockPlusApi.toggle (package:wakelock_plus_platform_interface/messages.g.dart:100:7)

-1 MethodChannelWakelockPlus.toggle (package:wakelock_plus_platform_interface/src/method_channel_wakelock_plus.dart:20:5)
diegotori commented 8 months ago

@arabnology Need more than just that.

The exact platform in which it was made.

arabnology commented 8 months ago

@arabnology Need more than just that.

The exact platform in which it was made.

That's all what i got in the log section.

Tested on Android 14 and iOS 17

@override
  void initState() {
    super.initState();
    WakelockPlus.enable(); //enable screen wakelock.
  }

  @override
  void dispose() {
    super.dispose();
    WakelockPlus.disable(); //disable screen wakelock.
  }

The code above called in the first screen after app initialization complete.

App initialization code(Main function):

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await SystemChrome.setPreferredOrientations(const [
    DeviceOrientation.portraitUp,
  ]);
  //Other code...
}
corepuncher commented 8 months ago

Wont' work for me.

Galaxy S23, API 34, Java 17, latest dart and flutter.

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null) E/flutter (14135): #0 WakelockPlusApi.toggle (package:wakelock_plus_platform_interface/messages.g.dart:100:7) E/flutter (14135): E/flutter (14135): #1 MethodChannelWakelockPlus.toggle (package:wakelock_plus_platform_interface/src/method_channel_wakelock_plus.dart:20:5)

diegotori commented 8 months ago

@arabnology and @corepuncher, what I would suggest is to first run flutter clean, then flutter pub upgrade so that it upgrades any transitive dependencies that wakelock_plus uses. This is usually the case when upgrading to breaking library versions. I've had this happen to me recently when upgrading Flutter versions, where I would forget to run flutter pub upgrade so that it upgrades any Flutter based transitive dependencies that support the latest version.

Right now, I'm unable to reproduce this in the example app, especially when running it on my personal Google Pixel 7 running Android 14. Keep in mind that I also ran flutter clean and flutter pub upgrade so that it would have everything good and ready when running the example app.

diegotori commented 8 months ago

@arabnology and @corepuncher, looks like I spoke too soon. Turns out, when I released version 1.2.0, it was using an older version of wakelock_plus_platform_interface that was not published beforehand, where I did make changes. As a result, the example app for some reason was using the local version, which didn't have these issues.

Bottom line, it worked fine on the example app because it re-routed wakelock_plus_platform_interface back to the local version. Chalk it up to good old-fashioned confirmation bias.

As a result, released wakelock_plus_platform_interface version 1.2.0 and subsequently released wakelock_plus version 1.2.1 which uses the aforementioned updated version.

fabiomicheldossantos commented 8 months ago

I'm using version 1.2.1 and the same problem is occurring.

corepuncher commented 8 months ago

@arabnology and @corepuncher, looks like I spoke too soon. Turns out, when I released version 1.2.0, it was using an older version of wakelock_plus_platform_interface that was not published beforehand, where I did make changes. As a result, the example app for some reason was using the local version, which didn't have these issues.

Bottom line, it worked fine on the example app because it re-routed wakelock_plus_platform_interface back to the local version. Chalk it up to good old-fashioned confirmation bias.

As a result, released wakelock_plus_platform_interface version 1.2.0 and subsequently released wakelock_plus version 1.2.1 which uses the aforementioned updated version.

1.21 fixed the issue for me.

fabiomicheldossantos commented 8 months ago

For me the following error is presented. This started to occur after generating a new flutter project in version 3.9.15.

Error
Launching lib/main.dart on sdk gphone64 arm64 in debug mode... Running Gradle task 'assembleDebug'... e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors e: /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (14, 10): Unresolved reference: listOf e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (19, 12): Unresolved reference: listOf e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (25, 12): Unresolved reference: listOf e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (26, 17): Unresolved reference: javaClass e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (55, 6): Class 'kotlin.Suppress' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Suppress.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (62, 12): Unresolved reference: listOf e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (78, 6): Class 'kotlin.Suppress' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Suppress.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (85, 12): Unresolved reference: listOf e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (90, 2): Class 'kotlin.Suppress' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Suppress.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (95, 52): Unresolved reference: let e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (96, 37): Unresolved reference: it e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (100, 52): Unresolved reference: let e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (101, 34): Unresolved reference: it e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (108, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (110, 16): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (111, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (114, 16): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (115, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (117, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (129, 38): Unresolved reference: lazy e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (133, 6): Class 'kotlin.Suppress' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Suppress.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (135, 7): Unresolved reference: run e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (137, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (138, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (142, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (143, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (144, 25): Unresolved reference: listOf e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (148, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (151, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (154, 7): Unresolved reference: run e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (156, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (157, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (159, 13): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (160, 25): Unresolved reference: listOf e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (164, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Messages.g.kt: (167, 19): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Wakelock.kt: (23, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Wakelock.kt: (24, 37): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/Wakelock.kt: (26, 23): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusPlugin.kt: (16, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusPlugin.kt: (17, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusPlugin.kt: (21, 21): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusPlugin.kt: (22, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusPlugin.kt: (26, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusPlugin.kt: (30, 15): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusPlugin.kt: (34, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusPlugin.kt: (38, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class e: /Users/fabiomicheldossantos/.pub-cache/hosted/pub.dev/wakelock_plus-1.2.1/android/src/main/kotlin/dev/fluttercommunity/plus/wakelock/WakelockPlusPlugin.kt: (42, 16): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. The class is loaded from /Users/fabiomicheldossantos/.gradle/caches/transforms-3/358d165d19f9d7fe7ae0c847419fff2e/transformed/jetified-kotlin-stdlib-1.9.23.jar!/kotlin/Unit.class FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':wakelock_plus:compileDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more details * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 5s ┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────┐ │ [!] Your project requires a newer version of the Kotlin Gradle plugin. │ │ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │ │ update /Users/fabiomicheldossantos/StudioProjects/ide/android/build.gradle: │ │ ext.kotlin_version = '' │ └────────────────────────────────────────────────────────────────────────────────────────────┘ Error: Gradle task assembleDebug failed with exit code 1
diegotori commented 7 months ago

For me the following error is presented. This started to occur after generating a new flutter project in version 3.9.15.

Error

You need to be using at least Flutter 3.19 or higher.

Try that first, since that's the minimum version that you need going forward.

fabiomicheldossantos commented 7 months ago

For me the following error is presented. This started to occur after generating a new flutter project in version 3.9.15. Error

You need to be using at least Flutter 3.19 or higher.

Try that first, since that's the minimum version that you need going forward.

Oh sorry. I wrote wrong. I am using version 3.19.5. (Channel stable, 3.19.5, on macOS 14.3.1 23D60 darwin-arm64, locale pt-BR).

Have you tried creating a new flutter project and running wakelockplus on it?

diegotori commented 7 months ago

@fabiomicheldossantos yup, I see what you mean now.

Looks like the upgrades to the Android integration broke due to it forcing a much higher Kotlin version that what people usually use.

Nevertheless, it's now straightened out once you build using Java 17 and Android Gradle Plugin 8.3.x.

Expect a PR very shortly.

diegotori commented 7 months ago

@fabiomicheldossantos published version 1.2.2 which brings the Android integration in line with the rest of the plus_plugins.

fabiomicheldossantos commented 7 months ago

Good morning, @diegotori! I tested it here and it worked! There was only a conflict with the parse_server_sdk_flutter package because of package_info_plus, but I resolved this by overwriting the package_info_plus package to version 6.0.0. Thank you very much for your attention. God bless you!

kalismeras61 commented 7 months ago

I have this problem, even if I use 1.1.1 I have the same problem. I get it not only on android but also on ios.

`[log] #0 WakelockPlusApi.toggle (package:wakelock_plus_platform_interface/messages.g.dart:124:7)

#1 MethodChannelWakelockPlus.toggle (package:wakelock_plus_platform_interface/src/method_channel_wakelock_plus.dart:20:5) `
diegotori commented 7 months ago

@kalismeras61 I would upgrade to 1.2.2, which solves a bunch of issues related to pigeon.

adamkoch commented 6 months ago

Due to other dependencies, I wasn't able to upgrade wakelock_plus to the latest and was still running into this issue.

Putting my fix here in case anyone else is in a similar situation. I had to lock to the matching version of wakelock_plus_platform_interface by adding it to my own pubspec.yaml (if not, a pub upgrade would move it to the broken version which would break things):

  wakelock_plus: 1.1.4
  wakelock_plus_platform_interface: 1.1.0
atoka93 commented 6 months ago

Hi @diegotori, I also get this exception using version 1.2.4, both on Android and iOS:

messages.g.dart in WakelockPlusApi.toggle at line 124 within wakelock_plus_platform_interface
In App
<asynchronous suspension>
method_channel_wakelock_plus.dart in MethodChannelWakelockPlus.toggle at line 20 within wakelock_plus_platform_interface

It doesn't happen all the time, only in some instances.