我有api键,我认为我的编码很好,但没有显示...
在应用程序上,谷歌地图片段如下所示 https://imgur.com/3XtZBgw
在Java文件上
Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.String[][]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'data.first_name', line 1, position 39.
在main.xml上
public static GoogleMap map;
onCreate(){
...
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.maps);
mapFragment.getMapAsync(this);
//and it fires overrided onMapReady function
}
@Override
public void onMapReady(final GoogleMap googleMap) {
Log.e("dialog","on map ready");
Log.e("dialog",googleMap.toString());
map = googleMap;
map.setOnMarkerClickListener(this);
map.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng arg0) {
Log.e("dialog","map clicked"+arg0.toString());
}
});
}
答案 0 :(得分:0)
除了将API密钥添加到AndroidManifest.xml
之外,请确保通过Google Developer Console将应用程序的软件包名称和SHA-1证书指纹添加到所述API密钥。
还要确保您已在Google Developer Console中启用了API。
答案 1 :(得分:0)
有以下可能性,地图无法正常工作,请确认并检查
AndroidManifest.xml
文件中添加了地图API密钥,例如波纹管
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="Your API KEY" />
Map SDK for Android Enabled
在验证了以上所有步骤之后,也无法正常工作。
请尝试重新安装您的应用。