-
Notifications
You must be signed in to change notification settings - Fork 195
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
VoiceInstructionsEnabled has an issue. #359
Comments
I think, It comes from wrong configration setting. Android Configuration
After adding the above, your gradle.properties file may look something like this:
class MainActivity: FlutterFragmentActivity() { |
Thanks for reaching out. @fc0101 |
the main error is following: |
The Given that this issue arises specifically when Steps to Diagnose and Fix the Issue
Example Inspection and Fix Here's an example of how you might inspect and fix the URL generation logic: // Assume this is the part of your code where the URL is generated
fun generateDirectionsUrl(params: DirectionsParams): String {
val baseUrl = "https://api.mapbox.com"
val endpoint = "/directions/v5/mapbox/driving"
// Construct the waypoints part of the URL
val waypoints = params.waypoints.joinToString(";") { "${it.longitude},${it.latitude}" }
// Construct other query parameters
val queryParams = "access_token=${params.accessToken}&alternatives=true&steps=true&geometries=polyline6"
// Combine all parts to form the complete URL
val url = "$baseUrl$endpoint/$waypoints?$queryParams"
return url
}
// Example usage
val directionsParams = DirectionsParams(
accessToken = "pk.************************************",
waypoints = listOf(
Waypoint(-6.58909461927, 53.3826809636),
Waypoint(-6.587864, 53.388655),
// add other waypoints
)
)
val directionsUrl = generateDirectionsUrl(directionsParams) Check for Conditional Logic Ensure that any conditional logic based on val voiceInstructionsEnabled = false // or true
val directionsUrl = if (voiceInstructionsEnabled) {
generateDirectionsUrlWithVoice(params)
} else {
generateDirectionsUrlWithoutVoice(params)
}
// Ensure both functions generate complete URLs
fun generateDirectionsUrlWithVoice(params: DirectionsParams): String {
val baseUrl = "https://api.mapbox.com"
val endpoint = "/directions/v5/mapbox/driving"
// construct URL as before
// ensure the protocol is included
}
fun generateDirectionsUrlWithoutVoice(params: DirectionsParams): String {
val baseUrl = "https://api.mapbox.com"
val endpoint = "/directions/v5/mapbox/driving"
// construct URL as before
// ensure the protocol is included
} Add Logging Add logging to check the URL generated in both cases: val directionsUrl = if (voiceInstructionsEnabled) {
generateDirectionsUrlWithVoice(params)
} else {
generateDirectionsUrlWithoutVoice(params)
}
Log.d("Generated URL", directionsUrl) The |
I am using the latest verstion of the plugin (0.2.2) also.
And if I set voiceInstructionsEnabled: false, the app is shut down unexpectly.
But the app runs flexible if voiceInstructionsEnable: true.
So I cannot customize voiceInstruction.
How can I resolve this?
E/AndroidRuntime(27278): FATAL EXCEPTION: main
E/AndroidRuntime(27278): Process: com.example.untitled, PID: 27278
E/AndroidRuntime(27278): java.net.MalformedURLException: no protocol: /directions/v5/mapbox/driving/-6.58909461927%2C53.3826809636;-6.587864%2C53.388655;-6.589743%2C53.387647;-6.599891%2C53.389552;-6.599701%2C53.389442;-6.59922%2C53.390455;-6.590373%2C53.382565?access_token=pk***********************************************************************************************&alternatives=true&avoid_maneuver_radius=18.031&bearings=151.365%2C45%3B%3B%3B%3B%3B%3B&continue_straight=true&enable_refresh=true&geometries=polyline6&layers=0%3B%3B%3B%3B%3B%3B&routes_history=KPXGmPFtKwnbI6HMo6FRbRxdivKvP0ZHiDyopIeIl77o0tgPRT9r1A%3D%3D_us-west-2%2C0%2C0&steps=true&waypoint_names=%3BLyreen%20Lawn%3BLyreen%20Drive%3BMoyglare%20Village%3BMoyglare%20Village%3BMoyglare%20Abbey%3BCross%20Lane&waypoints=0%3B1%3B2%3B3%3B4%3B5%3B6
E/AndroidRuntime(27278): at java.net.URL.(URL.java:601)
E/AndroidRuntime(27278): at java.net.URL.(URL.java:498)
E/AndroidRuntime(27278): at java.net.URL.(URL.java:447)
E/AndroidRuntime(27278): at com.mapbox.navigation.base.route.NavigationRouteEx.toNavigationRoute(NavigationRoute.kt:588)
E/AndroidRuntime(27278): at com.mapbox.navigation.base.internal.route.NavigationRouteEx.toNavigationRoute(NavigationRouteEx.kt:244)
E/AndroidRuntime(27278): at com.mapbox.navigation.base.internal.utils.DirectionsResponseUtilsKt.parseRouteInterface(DirectionsResponseUtils.kt:59)
E/AndroidRuntime(27278): at com.mapbox.navigation.base.internal.utils.DirectionsResponseUtilsKt.parseNativeDirectionsAlternative(DirectionsResponseUtils.kt:51)
E/AndroidRuntime(27278): at com.mapbox.navigation.core.routealternatives.RouteAlternativesController$processRouteAlternatives$1$alternatives$1$expected$1.invokeSuspend(RouteAlternativesController.kt:219)
E/AndroidRuntime(27278): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/AndroidRuntime(27278): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
E/AndroidRuntime(27278): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
E/AndroidRuntime(27278): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
E/AndroidRuntime(27278): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
E/AndroidRuntime(27278): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
E/AndroidRuntime(27278): Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@eec93ae, Dispatchers.Main]
I/Process (27278): Sending signal. PID: 27278 SIG: 9
Lost connection to device.
The text was updated successfully, but these errors were encountered: