googlemaps / react-native-navigation-sdk

React Native library (Beta) for bringing Google Navigation SDK to Android and iOS apps using React.
https://www.npmjs.com/package/@googlemaps/react-native-navigation-sdk
Apache License 2.0
29 stars 6 forks source link

java.lang.NoSuchMethodError: No virtual method ifPresentOrElse #335

Open ziga-hvalec opened 3 days ago

ziga-hvalec commented 3 days ago

This started happening on 0.8.0. It happens when users navigate to the screen where we have the navigation. We have very limited release right now so we don't yet have a lot of data. Happens every time. This happened until now only Galaxy Note10+ with android 12.

java.lang.NoSuchMethodError: No virtual method ifPresentOrElse(Ljava/util/function/Consumer;Ljava/lang/Runnable;)V in class Ljava/util/Optional; or its super classes (declaration of 'java.util.Optional' appears in /apex/com.android.art/javalib/core-oj.jar) at com.google.android.gms.internal.auth.zzcc$$ExternalSyntheticApiModelOutline0.m at com.google.android.libraries.navigation.internal.dx.v.run(PG:7) at com.google.android.libraries.geo.mapcore.renderer.at.b(PG:56) at com.google.android.libraries.navigation.internal.py.ad.e(PG:23) at com.google.android.libraries.geo.mapcore.renderer.bj.run(PG:60)

ziga-hvalec commented 3 days ago

we were able to reproduce this on another device with android 12.

Edit: Seems to be an issue on all version with android 12 and bellow

ziga-hvalec commented 3 days ago

I figured out that as soon as i call navigationController.init() app crashes. Map without navigation works correctly.

jokerttu commented 3 days ago

@illuminati1911 can you check this?

illuminati1911 commented 2 days ago

Hey @ziga-hvalec, which JDK version are you using?

ziga-hvalec commented 2 days ago

We use JDK 17.

jokerttu commented 1 day ago

@ziga-hvalec, we haven't been able to reproduce this exact issue yet. Could you provide more details on your build.gradle file configuration, specifically:

compileOptions minSdkVersion targetSdkVersion compileSdkVersion

This issue is most likely related to Java compatibility and may require the use of desugaring libraries. Please refer to the release notes for Android SDK version 6.0.0 at: https://developers.google.com/maps/documentation/navigation/android-sdk/release-notes#September_13_2024

An issue related to the use of earlier versions of desugaring libraries may cause some apps that implement the Navigation SDK to crash with the following NoSuchMethod error at runtime: No virtual method toSeconds()J in class Ljava/time/Duration; or its super classes (declaration of 'java.time.Duration' appears in ...) If you experience this issue, update your app to use com.android.tools:desugar_jdk_libs_nio:2.0.3 for desugaring. You may also need to upgrade to Gradle 8.4 and the Android Gradle plugin version 8.3.0. For more information, see Set up your Android Studio project or the Navigation SDK sample app on GitHub.

xiaobc1234 commented 18 hours ago

Is this problem solved? I am using desugaring libraries locally and it still crashes on Java 17. My phone is running Android 10.The error message is as follows:

FATAL EXCEPTION: GL-Map Process: com.sampleapp, PID: 30434 java.lang.NoSuchMethodError: No virtual method ifPresentOrElse(Ljava/util/function/Consumer;Ljava/lang/Runnable;)V in class Ljava/util/Optional; or its super classes (declaration of 'java.util.Optional' appears in /apex/com.android.runtime/javalib/core-oj.jar) at com.google.android.libraries.navigation.internal.dx.v.run(PG:7) at com.google.android.libraries.geo.mapcore.renderer.at.b(PG:56) at com.google.android.libraries.navigation.internal.py.ad.e(PG:23) at com.google.android.libraries.geo.mapcore.renderer.bj.run(PG:60)

ziga-hvalec commented 18 hours ago

Do we know which version of java we should be using?