3

I am trying to get the LocalTimeZone in my Flutter app. For this purpose, I used 'package:timezone/timezone.dart' with a conjunction of 'package:flutter_native_timezone/flutter_native_timezone.dart';. But when I install the flutter_native_timezone v.2.0.0. I got an error in Android build like this:

FAILURE: Build failed with an exception.

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':flutter_native_timezone' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50

* 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 1s
Exception: Gradle task assembleDebug failed with exit code 1

My Kotlin plugin version is 1.8.10. I tried to downgrade it to 1.5.20, but same result. I tried with the lower version of the library but the error still persists.

flutter doctor output looks like this:

[✓] Flutter (Channel stable, 3.7.12, on macOS 12.0.1 21A559 darwin-arm64, locale en-BG)

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)

[✓] Chrome - develop for the web

[✓] Android Studio (version 2022.2)

[✓] Android Studio (version 2021.1)

[✓] VS Code (version 1.79.2)

[✓] VS Code (version 1.64.2)

[✓] Connected device (3 available)

[✓] HTTP Host Availability

2 Answers 2

7

try flutter_timezone which is a fork of the repository you were using initially using

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you for the answer, but I do not need the time zone. I need to run the library because I need the location. I need to determinate the hardcoded string in the getLocation here: tz.setLocalLocation(tz.getLocation('Europe/Sofia')); and it seem the in Flutter this lib is the only way that I found.
OK, i see. Maybe you could try flutter_timezone which is a fork of the repository you were using initially here is the link : pub.dev/packages/flutter_timezone
Thanks, It seems promising I will try and tell
This works, edit your answer with this library in order to mark it as assessed.
0

try flutter_timezone, then use enter link description here

tz.initializeTimeZones();
tz.setLocalLocation(tz.getLocation(""));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.