com.google.android.gms在哪里?

时间:2022-10-12 07:30:47

Today I updated Android SDK components to the newest version and somehow the whole com.google.android.gms package is gone. Instead, there is only com.google.android.maps with different classes than those in gms package. Is it a big change form Google or have I done something wrong? I have been using GoogleMap and LatLng classes to work with google maps and now I have just errors in my project.

今天我将Android SDK组件更新到最新版本,不知怎的,整个com.google.android.gms包已经消失了。相反,只有com.google.android.maps与gms包中的类不同。这是Google的重大变化还是我做错了什么?我一直在使用GoogleMap和LatLng类来处理谷歌地图,现在我的项目中只有错误。

6 个解决方案

#1


16  

Is it a big change form Google or have I done something wrong?

这是Google的重大变化还是我做错了什么?

com.google.android.gms comes from the Play Services SDK, which you attach to your application project as an Android library project. Please check your environment to ensure that you have a valid copy of the Play Services library project and that your application project still points to it.

com.google.android.gms来自Play Services SDK,您将其作为Android库项目附加到您的应用程序项目。请检查您的环境,以确保您拥有Play服务库项目的有效副本,并确保您的应用程序项目仍然指向它。

#2


4  

First off, if you did not run any updates with Android SDK Manager make sure the google-play-services-lib' project is open in eclipse. If this doesn't fix your problem then proceed. Note: eclipse(v22.0.1-685705) will close google-play-services-lib project with a 'close unrelated projects' command. The google-play-services-lib project must be open.

首先,如果您没有使用Android SDK Manager运行任何更新,请确保在eclipse中打开google-play-services-lib'项目。如果这不能解决您的问题,请继续。注意:eclipse(v22.0.1-685705)将使用'close unrelated projects'命令关闭google-play-services-lib项目。 google-play-services-lib项目必须是开放的。

I figured this problem out. Initially, you/I installed Google Play services in eclipse directly from the SDK Path, (SDK Path is displayed on the top left of Android SDK Manager). When you updated Google Play services with the Android SDK Manager it deleted the .project file and now eclipse can't find the 'google-play-services-lib' project and your development project fails to compile. :-(

我想出了这个问题。最初,您/我直接从SDK Path安装了eclipse中的Google Play服务(SDK Path显示在Android SDK Manager的左上角)。当您使用Android SDK Manager更新Google Play服务时,它删除了.project文件,现在eclipse无法找到'google-play-services-lib'项目,并且您的开发项目无法编译。 :-(

Solution:

解:

The basic ideal of this solution is to clean out the old 'google-play-services-lib' project in eclipse, which is now defunct and install a new one with the project copied from the SDK path.

这个解决方案的基本理想是清除eclipse中旧的'google-play-services-lib'项目,该项目现已不存在,并安装了一个新的项目,该项目从SDK路径复制。

Delete the old project:

删除旧项目:

In eclipse delete any 'google-play-services-lib' project. (In Eclipse see: Project properties-> Android -> Library.)

在eclipse中删除任何'google-play-services-lib'项目。 (在Eclipse中看到:Project properties-> Android - > Library。)

In In Eclipse see: Project properties-> Android -> Library delete the old entry for 'google-play-services-lib' project. This will most likely have an red 'X' on it.

在In Eclipse中,请参阅:项目属性 - > Android - >库删除“google-play-services-lib”项目的旧条目。这很可能会有一个红色的“X”。

Install a new one:

安装一个新的:

Follow the instruction from Google to install 'google-play-services-lib' project. These instruction specify to copy the project out of the SDK install folder; and then how to set up the projects.

按照Google的说明安装“google-play-services-lib”项目。这些指令指定将项目从SDK安装文件夹中复制出来;然后如何设置项目。

http://developer.android.com/google/play-services/setup.html

http://developer.android.com/google/play-services/setup.html

Notes:

笔记:

Your name for 'google-play-services-lib' may be different.

您对'google-play-services-lib'的名称可能有所不同。

The key to remember is that Google play services is not a jar file. It is a project in eclipse. Your, development project references the google-play-services-lib project.

要记住的关键是Google Play服务不是jar文件。这是日食中的一个项目。您的开发项目引用了google-play-services-lib项目。

By copying the project folder from the SDK path to another location, this will keep the Android SDK Manager from deleting your eclipse .project file, and causing this problem. The draw back is if you would like to update google play services, you have to remember to do all the steps again.

通过将项目文件夹从SDK路径复制到另一个位置,这将使Android SDK Manager不会删除您的eclipse .project文件,并导致此问题。退款是如果您想要更新谷歌播放服务,您必须记住再次执行所有步骤。

#3


1  

You will need Google Play Services sdk. You can install it from Android SDK Manager, if you are using sdk for eclipse.
After installing Google Play services, you can import the library project in your Workspace from ..\sdk\extras\google\google_play_services folder. Clean and build it.
Now you can go to the properties of project having problem and select the library project in Android section.
This should work!

您需要Google Play服务sdk。如果您使用sdk进行eclipse,则可以从Android SDK Manager安装它。安装Google Play服务后,您可以从.. \ sdk \ extras \ google \ google_play_services文件夹中导入工作区中的库项目。清洁并建造它。现在您可以转到有问题的项目的属性,并在Android部分中选择库项目。这应该工作!

#4


0  

If using Android Studio you can add the Google Play Services to use the Google Android Maps v2 by adding a dependency to the build.gradle file

如果使用Android Studio,您可以通过向build.gradle文件添加依赖项来添加Google Play服务以使用Google Android Maps v2

dependencies {
compile 'com.google.android.gms:play-services:3.1.36'

}

}

#5


0  

Currently library is in Google Repository. To enable it make sure you have downloaded it using Android SDK Manager (down to the very bottom of the list).

目前,图书馆位于Google Repository中。要启用它,请确保已使用Android SDK Manager下载它(直到列表的最底部)。

#6


0  

For android create project [...] ant CLI-based project

对于android create project [...] ant基于CLI的项目

Similar to: How to correctly include the support library in non-Eclipse Android application

类似于:如何在非Eclipse Android应用程序中正确包含支持库

The best I could find was https://*.com/a/30689979/895245:

我能找到的最好的是https://*.com/a/30689979/895245:

  1. copy paste android-sdk/extras/google/google_play_services/libproject/google-play-services_lib directory in the project directory
  2. 在项目目录中复制粘贴android-sdk / extras / google / google_play_services / libproject / google-play-services_lib目录
  3. cd into it and run android update project -p . -t android-22
  4. cd进入它并运行android update project -p。 -t android-22
  5. add <property name="android.library.reference.1" value="./google-play-services_lib"/> to your build.xml.
  6. 添加到build.xml中。

You can install extras with the android GUI tool, or with this CLI method: Downloading the Android support library from command line

您可以使用android GUI工具或使用此CLI方法安装附加组件:从命令行下载Android支持库

If you just copy paste the .jar in <sdk>/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar under the libs/ directory of the project, it compiles but breaks at runtime because of the required res/values/version.xml which is not included in the .jar.

如果您只是复制粘贴.jar在项目的libs /目录下的 /extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar中,它会编译但会中断运行时,因为所需的res / values / version.xml未包含在.jar中。

#1


16  

Is it a big change form Google or have I done something wrong?

这是Google的重大变化还是我做错了什么?

com.google.android.gms comes from the Play Services SDK, which you attach to your application project as an Android library project. Please check your environment to ensure that you have a valid copy of the Play Services library project and that your application project still points to it.

com.google.android.gms来自Play Services SDK,您将其作为Android库项目附加到您的应用程序项目。请检查您的环境,以确保您拥有Play服务库项目的有效副本,并确保您的应用程序项目仍然指向它。

#2


4  

First off, if you did not run any updates with Android SDK Manager make sure the google-play-services-lib' project is open in eclipse. If this doesn't fix your problem then proceed. Note: eclipse(v22.0.1-685705) will close google-play-services-lib project with a 'close unrelated projects' command. The google-play-services-lib project must be open.

首先,如果您没有使用Android SDK Manager运行任何更新,请确保在eclipse中打开google-play-services-lib'项目。如果这不能解决您的问题,请继续。注意:eclipse(v22.0.1-685705)将使用'close unrelated projects'命令关闭google-play-services-lib项目。 google-play-services-lib项目必须是开放的。

I figured this problem out. Initially, you/I installed Google Play services in eclipse directly from the SDK Path, (SDK Path is displayed on the top left of Android SDK Manager). When you updated Google Play services with the Android SDK Manager it deleted the .project file and now eclipse can't find the 'google-play-services-lib' project and your development project fails to compile. :-(

我想出了这个问题。最初,您/我直接从SDK Path安装了eclipse中的Google Play服务(SDK Path显示在Android SDK Manager的左上角)。当您使用Android SDK Manager更新Google Play服务时,它删除了.project文件,现在eclipse无法找到'google-play-services-lib'项目,并且您的开发项目无法编译。 :-(

Solution:

解:

The basic ideal of this solution is to clean out the old 'google-play-services-lib' project in eclipse, which is now defunct and install a new one with the project copied from the SDK path.

这个解决方案的基本理想是清除eclipse中旧的'google-play-services-lib'项目,该项目现已不存在,并安装了一个新的项目,该项目从SDK路径复制。

Delete the old project:

删除旧项目:

In eclipse delete any 'google-play-services-lib' project. (In Eclipse see: Project properties-> Android -> Library.)

在eclipse中删除任何'google-play-services-lib'项目。 (在Eclipse中看到:Project properties-> Android - > Library。)

In In Eclipse see: Project properties-> Android -> Library delete the old entry for 'google-play-services-lib' project. This will most likely have an red 'X' on it.

在In Eclipse中,请参阅:项目属性 - > Android - >库删除“google-play-services-lib”项目的旧条目。这很可能会有一个红色的“X”。

Install a new one:

安装一个新的:

Follow the instruction from Google to install 'google-play-services-lib' project. These instruction specify to copy the project out of the SDK install folder; and then how to set up the projects.

按照Google的说明安装“google-play-services-lib”项目。这些指令指定将项目从SDK安装文件夹中复制出来;然后如何设置项目。

http://developer.android.com/google/play-services/setup.html

http://developer.android.com/google/play-services/setup.html

Notes:

笔记:

Your name for 'google-play-services-lib' may be different.

您对'google-play-services-lib'的名称可能有所不同。

The key to remember is that Google play services is not a jar file. It is a project in eclipse. Your, development project references the google-play-services-lib project.

要记住的关键是Google Play服务不是jar文件。这是日食中的一个项目。您的开发项目引用了google-play-services-lib项目。

By copying the project folder from the SDK path to another location, this will keep the Android SDK Manager from deleting your eclipse .project file, and causing this problem. The draw back is if you would like to update google play services, you have to remember to do all the steps again.

通过将项目文件夹从SDK路径复制到另一个位置,这将使Android SDK Manager不会删除您的eclipse .project文件,并导致此问题。退款是如果您想要更新谷歌播放服务,您必须记住再次执行所有步骤。

#3


1  

You will need Google Play Services sdk. You can install it from Android SDK Manager, if you are using sdk for eclipse.
After installing Google Play services, you can import the library project in your Workspace from ..\sdk\extras\google\google_play_services folder. Clean and build it.
Now you can go to the properties of project having problem and select the library project in Android section.
This should work!

您需要Google Play服务sdk。如果您使用sdk进行eclipse,则可以从Android SDK Manager安装它。安装Google Play服务后,您可以从.. \ sdk \ extras \ google \ google_play_services文件夹中导入工作区中的库项目。清洁并建造它。现在您可以转到有问题的项目的属性,并在Android部分中选择库项目。这应该工作!

#4


0  

If using Android Studio you can add the Google Play Services to use the Google Android Maps v2 by adding a dependency to the build.gradle file

如果使用Android Studio,您可以通过向build.gradle文件添加依赖项来添加Google Play服务以使用Google Android Maps v2

dependencies {
compile 'com.google.android.gms:play-services:3.1.36'

}

}

#5


0  

Currently library is in Google Repository. To enable it make sure you have downloaded it using Android SDK Manager (down to the very bottom of the list).

目前,图书馆位于Google Repository中。要启用它,请确保已使用Android SDK Manager下载它(直到列表的最底部)。

#6


0  

For android create project [...] ant CLI-based project

对于android create project [...] ant基于CLI的项目

Similar to: How to correctly include the support library in non-Eclipse Android application

类似于:如何在非Eclipse Android应用程序中正确包含支持库

The best I could find was https://*.com/a/30689979/895245:

我能找到的最好的是https://*.com/a/30689979/895245:

  1. copy paste android-sdk/extras/google/google_play_services/libproject/google-play-services_lib directory in the project directory
  2. 在项目目录中复制粘贴android-sdk / extras / google / google_play_services / libproject / google-play-services_lib目录
  3. cd into it and run android update project -p . -t android-22
  4. cd进入它并运行android update project -p。 -t android-22
  5. add <property name="android.library.reference.1" value="./google-play-services_lib"/> to your build.xml.
  6. 添加到build.xml中。

You can install extras with the android GUI tool, or with this CLI method: Downloading the Android support library from command line

您可以使用android GUI工具或使用此CLI方法安装附加组件:从命令行下载Android支持库

If you just copy paste the .jar in <sdk>/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar under the libs/ directory of the project, it compiles but breaks at runtime because of the required res/values/version.xml which is not included in the .jar.

如果您只是复制粘贴.jar在项目的libs /目录下的 /extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar中,它会编译但会中断运行时,因为所需的res / values / version.xml未包含在.jar中。