0

所以我按照本指南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 />在应用程序标签中。

4

3 回答 3

1

要使您的应用可以使用 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" />
于 2015-12-08T13:50:26.767 回答
0

基本上不需要下载 google play services 库,它只存在于您的 SDK 中

这是路径,你可以找到图书馆

.../sdk/extras/google/google_play_services/libproject/google-play-services_lib
于 2015-12-08T13:41:04.500 回答
0

我认为以下可以解决您的问题:

 <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyCzVDpAckc5p3DGRIJsco-CyIiFfjgn--k" />
                                                              ^
                                                              !    
于 2015-12-08T13:51:43.690 回答