mapbox / mapbox-navigation-android

Mapbox Navigation SDK for Android
https://docs.mapbox.com/android/navigation/overview/
Other
622 stars 318 forks source link

Navigation SDK throw MapboxInvalidModuleException #4907

Closed xiaxiayige closed 2 years ago

xiaxiayige commented 2 years ago

Environment

Observed behavior and steps to reproduce

code

     navigationOptions = MapboxNavigation
                .defaultNavigationOptionsBuilder(activity.this, token)
                .build();
        mapboxNavigation = MapboxNavigationProvider.create(navigationOptions);

com.mapbox.common.module.provider.MapboxInvalidModuleException

NavigationRouter has been excluded from build but a correct alternative was not provided. Make sure that: - Your custom module implements com.mapbox.navigation.base.route.Router. - Your custom module class is annotated with @MapboxModule(a.NavigationRouter). - You've provided a ModuleProvider instance to Mapbox_RouterModuleConfiguration#setModuleProvider before initializing the library, unless enableConfiguration flag is set to false and your implementation has a public, non-arg constructor or is a Kotlin object.

Caused by: com.mapbox.common.module.provider.MapboxInvalidModuleException:NavigationRouter has been excluded from build but a correct alternative was not provided. Make sure that:

xiaxiayige commented 2 years ago
more log :

09-26 12:07:05.295 25792 25792      E     MapboxModuleProvider: Module loading failed
1009-26 12:07:05.295 25792 25792 E MapboxModuleProvider: java.lang.NoSuchMethodException: com.mapbox.navigation.route.internal.hybrid.MapboxHybridRouter.<init> []

1109-26 12:07:05.295 25792 25792 E MapboxModuleProvider: at java.lang.Class.getConstructor0(Class.java:2332)

1209-26 12:07:05.295 25792 25792 E MapboxModuleProvider: at java.lang.Class.getConstructor(Class.java:1728)

1309-26 12:07:05.295 25792 25792 E MapboxModuleProvider: at com.mapbox.common.module.provider.MapboxModuleProvider$noArgConstructorCreator$1.getInstance(MapboxModuleProvider.kt:107)

1409-26 12:07:05.295 25792 25792 E MapboxModuleProvider: at com.mapbox.common.module.provider.MapboxModuleProvider.createModule(MapboxModuleProvider.kt:69)

1509-26 12:07:05.295 25792 25792 E MapboxModuleProvider: at com.mapbox.navigation.core.a.<init>(MapboxNavigation.kt:179)

1609-26 12:07:05.295 25792 25792 E MapboxModuleProvider: at com.mapbox.navigation.core.c.a(MapboxNavigationProvider.kt:23)
sjd753 commented 2 years ago

I got the same error on API 31. It happens because of Pending Intent Flags Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.

Still not solutions found! Please update this thread if any solution found for API 31

samcrawford commented 2 years ago

Hit the same issue on Mapbox Navigation 2.0.0

LukasPaczos commented 2 years ago

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.

This has been resolved in https://github.com/mapbox/mapbox-navigation-android/pull/5105.

@xiaxiayige could you provide the full log for your issue? The exceptions that you linked are not what is causing the crash.

ShivaniChandel commented 2 years ago

Hi I am get these error Executing tasks: [clean, :app:assembleDebug] in project C:\Android Projects\LimeUser\Lime

Configure project :app Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin. AGPBI: {"kind":"warning","text":"We recommend using a newer Android Gradle plugin to use compileSdk = 32\n\nThis Android Gradle plugin (7.0.4) was tested up to compileSdk = 31\n\nThis warning can be suppressed by adding\n android.suppressUnsupportedCompileSdk=32\nto this project's gradle.properties\n\nThe build will continue, but you are strongly encouraged to update your project to\nuse a newer Android Gradle Plugin that has been tested with compileSdk = 32","sources":[{}]}

Task :clean UP-TO-DATE Task :app:clean UP-TO-DATE Task :app:preBuild UP-TO-DATE Task :app:preDebugBuild UP-TO-DATE Task :app:compileDebugAidl NO-SOURCE Task :app:compileDebugRenderscript NO-SOURCE Task :app:generateDebugBuildConfig Task :app:checkDebugAarMetadata FAILED Task :app:generateDebugResValues Task :app:generateDebugResources Task :app:processDebugGoogleServices Task :app:mergeDebugResources FAILED Task :app:createDebugCompatibleScreenManifests Task :app:extractDeepLinksDebug Task :app:processDebugMainManifest FAILED Task :app:mergeDebugNativeDebugMetadata NO-SOURCE Task :app:mergeDebugShaders Task :app:javaPreCompileDebug Task :app:compileDebugShaders NO-SOURCE Task :app:generateDebugAssets UP-TO-DATE Task :app:mergeDebugAssets FAILED Task :app:processDebugJavaRes NO-SOURCE Task :app:checkDebugDuplicateClasses FAILED Task :app:desugarDebugFileDependencies FAILED Task :app:mergeDebugJniLibFolders Task :app:mergeDebugNativeLibs FAILED Task :app:validateSigningDebug Task :app:writeDebugAppMetadata Task :app:writeDebugSigningConfigVersions

FAILURE: Build completed with 7 failures.

1: Task failed with an exception.

2: Task failed with an exception.

3: Task failed with an exception.

4: Task failed with an exception.

5: Task failed with an exception.

6: Task failed with an exception.

7: Task failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 6s 20 actionable tasks: 18 executed, 2 up-to-date

LukasPaczos commented 2 years ago

Hey @ShivaniChandel, there are no Mapbox Navigation SDK references in the traces you attached. Are you sure these problems are related?

I'm going to go ahead and close this issue. Feel free to open a new one if needed.