因此,我遵循了本指南https://developers.google.com/maps/documentation/android-api/signup
并Google Developer Console
在这里https://console.developers.google.com/home创建了一个新项目。
我把我的Eclipse
项目包的名字,并得到了Google Key
。
现在,如向导所说,我已将此添加到清单中
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY"/>
在我这样做之后,我的项目中出现了很多错误,并且我所有与此项目相关的地方都有一个红色的感叹号workspace
。
所以我做错了什么?我只想开始使用Google Play开发。而且,请阅读我的所有指南和eclipse的指南,但仍然无法解决。
编辑我想我可能会错过google play services library
。我找不到在哪里下载它。
清单:根据要求。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.minyan.get.dl"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="23" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MyLocation"
android:label="@string/title_activity_my_location" >
</activity>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCzVDpAckc5p3DGRIJsco-CyIiFfjgn--k />
</application>
</manifest>
像指南中的一样,<meta data />
在application标记中。
要使Google Play服务API可用于您的应用,请执行以下操作:
将库项目复制<android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/
到维护Android应用项目的位置。
将库项目导入到Eclipse工作区中。Click File > Import, select Android > Existing Android Code into Workspace,
并浏览到该库项目的副本以将其导入。
将Google Play服务库添加为应用程序项目的依赖项后,打开应用程序的清单文件,并将以下标记添加为<application>
元素的子项:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句