运行 HMS Map 演示代码时发现基础异常

Foundation exception found when running HMS Map demo code

我正在尝试 运行 我的设备上的 HMS 地图演示,但它无法正常工作。我用的是荣耀v30。我在日志中收到错误:

2021-03-25 17:50:04.567 22644-22644/com.huawei.hms.maps.sample E/hms.maps.sampl: Unknown bits set in runtime_flags: 0x8000
2021-03-25 17:50:04.664 22644-23636/com.huawei.hms.maps.sample E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@562ee
2021-03-25 17:50:20.861 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_PresentationLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.861 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_PresentationLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.862 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_PresentationLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.862 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_PresentationLogPusher_10: analyticsInstance is null
2021-03-25 17:50:20.869 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.870 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.870 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.871 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.872 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.872 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.873 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.874 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.874 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.875 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.875 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.876 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.877 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.877 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.878 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:20.879 22644-22644/com.huawei.hms.maps.sample E/HmsMapKit_AccessTraceLogPusher_73: analyticsInstance is null.
2021-03-25 17:50:21.021 22644-22644/com.huawei.hms.maps.sample E/HMSSDK_AGCUtils: Get client/cp_id failed: java.io.FileNotFoundException: agconnect-services.json
2021-03-25 17:50:21.021 22644-22644/com.huawei.hms.maps.sample E/HMSSDK_AGCUtils: The client/cp_id is null.
2021-03-25 17:50:21.718 22644-23809/com.huawei.hms.maps.sample E/HmsMapKit_TileClient_23: Exception occur
    com.huawei.hms.maps.foundation.client.mac: * * *E*U*S*_*E*I*D
        at com.huawei.hms.maps.foundation.client.mac$maa.b(Unknown Source:25)
        at com.huawei.hms.maps.foundation.client.mab.a(Unknown Source:20)
        at com.huawei.hms.maps.foundation.client.mab.a(Unknown Source:159)
        at com.huawei.hms.maps.provider.client.tile.maa.a(Unknown Source:1)
        at com.huawei.hms.maps.provider.client.tile.maa.lambda$gI3f4RyIuh0G4Qoia5V0XosFnEE(Unknown Source:0)
        at com.huawei.hms.maps.provider.client.tile.-$$Lambda$maa$gI3f4RyIuh0G4Qoia5V0XosFnEE.call(Unknown Source:6)
        at com.huawei.hms.maps.foundation.client.mab$maa.a(Unknown Source:3)
        at com.huawei.hms.maps.provider.client.tile.maa.c(Unknown Source:23)
        at com.huawei.hms.maps.provider.client.tile.maa.a(Unknown Source:4)
        at com.huawei.hms.maps.provider.cache.mad.a(Unknown Source:63)
        at com.huawei.hms.maps.provider.cache.mad$mac.startUrlRequest(Unknown Source:2)
        at com.huawei.map.MapController.startUrlRequest(Unknown Source:28)

您似乎缺少 agconnect-services.json。您需要将您的应用程序与您的开发人员控制台连接并下载 agconnect-services.json 并将其放置在应用程序级别目录中。

按照此处的指南获取完整说明:Link