我是 Android 开发新手。依照指示本教程我遇到错误The import com.google.android.gms cannot be resolved
当我将代码写入MainActivity.java
:
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
通过搜索各种修复程序,我确保尝试这些:
- 我已经通过以下方式下载了特定 API 级别的 Google API
Android SDK 管理器。
- 我检查了 Google API 作为项目构建目标。
- 我已经添加了
<uses-library android:name="com.google.android.maps" />
线进入AndroidManifest.xml
作为一个孩子<application>
tag.
- 我通过选择清理了项目
Project->Clean...
并建造了它
从头开始。
- 包括我
.jar
右键单击我的项目来获取地图文件,然后
构建路径并添加外部存档,将其定位在我的 SDK 中:android-sdk-windows\add-ons\addon_google_apis_google_inc_8\libs\maps
不幸的是,以上都没有帮助。
另一种方法是让 Eclipse 为您完成导入工作。将鼠标悬停在com.google.android.gms
导入无法解决,并在弹出菜单的底部选择修复项目设置...选项如下。然后会提示导入google play services库。选择它,你就可以开始了。
![enter image description here](https://i.stack.imgur.com/8OUlc.png)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)