Closed doc-rj-celltrak closed 3 years ago
Same issue on Xiaomi Redmi 4
Fatal Exception: java.lang.NoClassDefFoundError
Failed resolution of: Ljava/time/ZoneId;
com.whelksoft.flutter_native_timezone.FlutterNativeTimezonePlugin.onMethodCall (FlutterNativeTimezonePlugin.java)
io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.getStackTrace (MethodChannel.java)
io.flutter.embedding.engine.dart.DartMessenger.handleError (DartMessenger.java)
io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage (FlutterJNI.java)
android.os.MessageQueue.nativePollOnce (MessageQueue.java)
android.os.MessageQueue.next (MessageQueue.java:329)
android.os.Looper.loop (Looper.java:142)
android.app.ActivityThread.main (ActivityThread.java:6375)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:912)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:802)
the java.time package was added only in API 26.
https://developer.android.com/reference/java/time/package-summary
Don't know how to solve this issue.
I think that this can help:
https://developer.android.com/studio/write/java8-support-table https://developer.android.com/studio/write/java8-support#library-desugaring
Testing it right now
Let me know if it will help for someone
What was the reason to switch to ZoneId
in the first place?
This seems to have been the relevant commit: https://github.com/pinkfish/flutter_native_timezone/commit/65403d12ec75f7cf50e674dedaf5d43e47d7b433
On the "consumer" side, it seems like sticking to version 1.0.10 is the way to go for now.
With this breaking change (!), this should have been version 2.0.0 and not 1.1.0.
All the people who are using caret notation like:
flutter_native_timezone: ^1.0.10
are still getting version 1.1.0, since there are no other dependencies to prevent it from going to 1.1.0.
In that case, flutter_native_timezone: ^1.0.10
is the same as >=1.0.10 <2.0.0.
This caused 200 crashes in our app with the latest release, because all the users below Android 8 do not have ZoneID implemented.
Example:
I have this in my pubspec.yaml:
flutter_native_timezone: ^1.0.10
But when running a build, I get this:
2021-05-28T08:42:48.9147200Z w: /Users/runner/.pub-cache/hosted/pub.dartlang.org/flutter_native_timezone-1.1.0/android/src/main/kotlin/com/whelksoft/flutter_native_timezone/FlutterNativeTimezonePlugin.kt: (11, 48):
Notice the: flutter_native_timezone-1.1.0 part
@dinodzakmic Change version in pubspec.lock
@sanekyy I know, I will do it. That was not the point of my comment.
I have tested solution which I sent above. It works.
@sanekyy would you open a PR for the fix?
@dinodzakmic Change version in pubspec.lock
Don't change the pubspec.lock file. Make a dependency override instead in pubspec.yaml:
dependency_overrides:
flutter_native_timezone: 1.0.10
@dinodzakmic probably it would be enough to remove the ^ before 1.0.10 in your normal dependency in pubspec.yaml
I just saw this error this morning. The bad thing is my app is on production mode. Gladfully @sanekyy managed to find the workaround, thanks!
Can anyone confirm that version 2.0.0 fixes this crash on Android 7 and below?
Yes, after upgrading to version 2.0.0 it's working.
Updating to version 2.0.0
solved app crashing on Xiaomi Redmi 4X
with Android version: N2G47H 7.1.2
.
Thanks.
Updating to version 2.0.0
didn't solve the issue for me. I'm still getting the crash on Android 6.
Updating to version
2.0.0
didn't solve the issue for me. I'm still getting the crash on Android 6.
Hi! Could you provide crash logs please?
Really sorry. It seems it was a false alarm. now it's working :/
With version 1.1.0 of the plugin, this crash was seen on a Samsung Galaxy S7 Edge running Android 7.0.
Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/ZoneId; at com.whelksoft.flutter_native_timezone.FlutterNativeTimezonePlugin.onMethodCall(FlutterNativeTimezonePlugin.java) at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java) at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java) at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java) at android.os.MessageQueue.nativePollOnce(MessageQueue.java) at android.os.MessageQueue.next(MessageQueue.java:323) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:6688) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)