Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android ZoneID Crashes on Some Device/OS #25

Closed
doc-rj-celltrak opened this issue May 26, 2021 · 19 comments
Closed

Android ZoneID Crashes on Some Device/OS #25

doc-rj-celltrak opened this issue May 26, 2021 · 19 comments

Comments

@doc-rj-celltrak
Copy link

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)

@sanekyy
Copy link

sanekyy commented May 29, 2021

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)

@ShreeyansB
Copy link

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.

@sanekyy
Copy link

sanekyy commented May 29, 2021

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

@mr-
Copy link

mr- commented May 29, 2021

What was the reason to switch to ZoneId in the first place?
This seems to have been the relevant commit: 65403d1

On the "consumer" side, it seems like sticking to version 1.0.10 is the way to go for now.

@dinodzakmic
Copy link

dinodzakmic commented May 30, 2021

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

@sanekyy
Copy link

sanekyy commented May 30, 2021

@dinodzakmic
Change version in pubspec.lock

@dinodzakmic
Copy link

@sanekyy I know, I will do it.
That was not the point of my comment.

@sanekyy
Copy link

sanekyy commented May 30, 2021

I have tested solution which I sent above. It works.

@nohli
Copy link
Contributor

nohli commented Jun 2, 2021

@sanekyy would you open a PR for the fix?

@larssn
Copy link

larssn commented Jun 2, 2021

@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

@nohli
Copy link
Contributor

nohli commented Jun 3, 2021

@dinodzakmic probably it would be enough to remove the ^ before 1.0.10 in your normal dependency in pubspec.yaml

@iandis
Copy link

iandis commented Jun 3, 2021

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!

@otopba
Copy link
Contributor

otopba commented Jun 3, 2021

Fixed at #27

pinkfish added a commit that referenced this issue Jun 4, 2021
@nohli
Copy link
Contributor

nohli commented Jun 5, 2021

Can anyone confirm that version 2.0.0 fixes this crash on Android 7 and below?

@Shrey29ansh
Copy link

Yes, after upgrading to version 2.0.0 it's working.

@guyluz11
Copy link

Updating to version 2.0.0 solved app crashing on Xiaomi Redmi 4X with Android version: N2G47H 7.1.2.
Thanks.

@zjamshidi
Copy link

Updating to version 2.0.0 didn't solve the issue for me. I'm still getting the crash on Android 6.

@otopba
Copy link
Contributor

otopba commented Jul 23, 2021

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?

@zjamshidi
Copy link

Really sorry. It seems it was a false alarm. now it's working :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests