我已按照文档 here和 here (这很简单),但 map View 不加载任何图 block 。
我使用HMS Toolkit,配置向导成功。我还设置了我的 api key ,在我的应用程序类和我的 Activity 类 onCreate 中都使用了这一行。
MapsInitializer.setApiKey(HUAWEI_API_KEY);
以下是设备信息和 SDK 版本:
这是屏幕:
相关错误日志:
E/HmsMapKit_MapView_151: createDelegate: creator == null
E/HmsMapKit_GrsClient_24: GRS returns empty.
E/HmsMapKit_ErrorTraceLogPusher_4: cache error trace log : ErrorTraceLogDTO{ scenario = GET_GRS_URL_FAILED', message='GRS returns empty, service name is com.huawei.hms.map.'}
E/HmsMapKit_ErrorTraceLogPusher_12: eventId is null or empty.
E/HmsMapKit_AuthenticateClient_27: Exception occur com.huawei.hms.maps.foundation.client.c
E/HmsMapKit_ErrorTraceLogPusher_4: cache error trace log : ErrorTraceLogDTO{ scenario = ACCESS_SERVICE_ERROR', message='060001 : NETWORK_ERROR'}
E/HmsMapKit_AuthenticateCache_0: authenticate error, throw RetryException.
E/HmsMapKit_CopyrightDelegate_27: get copyright statement html data failed: htmlData = null
E/HmsMapKit_TileCache_38: startUrlRequest Identity fail, do not has permission get tile. authResult :060011
PS:我与 this demo 有完全相同的问题.
最佳答案
首先你可以引用this Docs看看是否有错误代码。
官方demo也运行不正确。所以问题很可能是由签名或 API key 问题引起的。
请检查如下:
(1) 在你项目的入口类中设置API key。
// In the entrance class (inherited from android.app.Application) of the app,
// call the setApiKey method in the overridden onCreate() method.
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
// Set the API key.
MapsInitializer.setApiKey("Your API Key");
}
}
(2) 在 Fragment 或 MapView 中设置 API key。@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate: ");
super.onCreate(savedInstanceState);
// Set the API key before calling setContentView.
MapsInitializer.setApiKey("Your API Key");
setContentView(R.layout.basic_demo);
有关此问题的不同原因的详细信息,您还可以引用此 answer .
关于android - 华为 map 不加载瓷砖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69072718/