无法将MapFragment解析为类型

时间:2014-01-22 09:21:44

标签: android google-maps

在运行我的应用程序(GoogleMaps)时,无法启动Android库项目?我怎么解决这个?

我的代码是:

mMap = ((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap(); 

它提供错误MapFragment cannot be resolved as a type

如何克服此错误?

1 个答案:

答案 0 :(得分:0)

尝试从你的android sdk导入google-play-services_lib到你当前的日食

lib的路径在

adt-bundle-windows-x86-20131030\sdk\extras\google\google_play_services\libproject\google-play-services_lib

要遵循的步骤

*In the Package Explorer, right-click the library project and select Properties.
*In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
*Select the "google-play-services_lib" checkbox and click Apply.
*Click OK to close the Properties window.

然后地图将正常运作