尝试在我的 android 项目中实现 google map API 并收到我的 java 代码下的警告错误
GoogleMap gMap;
gMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
LatLng Jamaica = new LatLng(18.1155173, -77.2760026);
gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(Jamaica, 13));
gMap.addMarker(new MarkerOptions()
.title("Jamaica")
.snippet("The greatest country in the world")
.position(Jamaica));
gMap.setMyLocationEnabled(true);
日志:
03-18 12:45:00.140: W/ActivityThread(10477): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
最佳答案
- 运行 `cmd` 并生成一个新的“SHA1” key 。
- 浏览到 https://code.google.com/apis/console/?noredirect `API 控制台` 页面。
- 用新的“sha1” key 替换旧的“ShA1”。
- 然后替换您的新 map 键。
您的问题已解决。我也有这个问题。 (我只改变了我的 map 键)
关于java - 无法创建谷歌地图 fragment ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22487282/