首页 > 解决方案 > RoutingEngine.calculateCarRoute 返回“RoutingError.timedOut”

问题描述

我正在尝试计算两个位置之间的路线,但RoutingEngine.calculateCarRoute总是立即返回RoutingError.timedOut。从字面上看,没有时间休息。这是我的代码。这是我的代码还是 SDK 的问题?我正在使用 Flutter SDK 版本 4.3.1.0。

await RoutingEngine().calculateCarRoute(
    [
      Waypoint(
          GeoCoordinates(
            departure.latitude,
            departure.longitude,
          ),
          WaypointType.stopover,
          500,
          360,
          90),
      Waypoint(
          GeoCoordinates(
            destination.latitude,
            destination.longitude,
          ),
          WaypointType.stopover,
          500,
          360,
          90)
    ],
    CarOptions(
        RouteOptions(
            OptimizationMode.fastest, 3, routeInformation.departureTime),
        RouteTextOptions(
            LanguageCode.deDe, TextFormat.plain, UnitSystem.metric),
        AvoidanceOptions([], [CountryCode.deu])),
    (RoutingError routingError, List<Route> routeList) async {

      // process result or receive error with callback

    }

更新

调试应用程序时崩溃并显示以下消息:

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7e9e500000
Abort message: '[FATAL] Storage.LevelDB - Cannot open database IO error: /12/LOCK @ ../../../../../external/leveldb/util/env_posix.cc:445 virtual leveldb::Status leveldb::(anonymous namespace)::PosixEnv::LockFile(const std::string &, leveldb::FileLock **): No such file or directory'
    x0  0000007ead01adc8  x1  0000007ea03bdd58  x2  0000000000000001  x3  0000000000000019
    x4  0000000000000188  x5  0000007e86be9732  x6  0000007f4ea2f000  x7  0000000003410486
    x8  0000000000000000  x9  0000000000000000  x10 0000007e9e480050  x11 000000000007ffb0
    x12 0000000000000000  x13 000000000007ffb1  x14 00399f1ee3a0f76d  x15 000052f562d4cd6a
    x16 0000007ea21ae398  x17 0000007f49c697b4  x18 0000000000000010  x19 0000007ea03bdd48
    x20 0000007ea03bdd58  x21 0000000000000001  x22 0000007ea21b9b74  x23 000000000007ffad
    x24 0000007ead01aae8  x25 0000007ead01ab18  x26 0000007e993f0e08  x27 0000000000000003
    x28 0000007ea27d44cc  x29 0000007ea2166558
    sp  0000007ea03bdd10  lr  0000007ea1d2b14c  pc  0000007ea1db321c
backtrace:
    #00 pc 00000000016e121c  /data/app/app-identifier-lo-9QLT1643OFdsEJYYtQg==/lib/arm64/libflutter.so (offset 0x1280000)
    #01 pc 0000000001659148  /data/app/app-identifier-lo-9QLT1643OFdsEJYYtQg==/lib/arm64/libflutter.so (offset 0x1280000)
    #02 pc 00000000016e75d4  /data/app/app-identifier-lo-9QLT1643OFdsEJYYtQg==/lib/arm64/libflutter.so (offset 0x1280000)
    #03 pc 0000000001774f88  /data/app/app-identifier-lo-9QLT1643OFdsEJYYtQg==/lib/arm64/libflutter.so (offset 0x1280000)
    #04 pc 0000000001657148  /data/app/app-identifier-lo-9QLT1643OFdsEJYYtQg==/lib/arm64/libflutter.so (offset 0x1280000)
    #05 pc 00000000016623a8  /data/app/app-identifier-lo-9QLT1643OFdsEJYYtQg==/lib/arm64/libflutter.so (offset 0x1280000)
    #06 pc 000000000175367c  /data/app/app-identifier-lo-9QLT1643OFdsEJYYtQg==/lib/arm64/libflutter.so (offset 0x1280000)
    #07 pc 0000000000001850  <anonymous:0000007e9e400000>
Lost connection to device.

因此,我认为这似乎是 SDK 的 C 代码中的一个问题。

更新 2

版本 4.3.2.0 解决了这个问题。

标签: flutterhere-api

解决方案


当设备的代理设置更改并禁止 Internet 连接时,也可能发生超时事件。

我建议添加权限处理(仅限 Android),看看这是否能解决您的调试问题。由于 Flutter 不关心,所以必须在原生 Android 项目中完成。您可以使用此帮助程序类从 HERE SDK 的内部清单请求所有权限。在这里可以看到一个集成示例。

其次,虽然 HERE SDK for Flutter 仍是 Beta 版,但已经有更多示例应用程序可用。您可以尝试执行官方示例应用程序之一,看看这是否能解决您的问题。这是路由示例的链接。


推荐阅读