找不到Google Play版本

时间:2015-05-08 15:27:49

标签: android google-play

我过去一直在使用Google Play,但在一个新项目中我遇到了一个奇怪的问题。我已经使用SDK Manager下载了GP,并通过Project Structure / Dependencies添加了它,它自动添加了build.gradle依赖项中的一行。 但是当我重建Project时,它失败了:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find any version that matches com.google.android.gms:play-services:+.
 Searched in the following locations:
     https://jcenter.bintray.com/com/google/android/gms/play-services/maven-metadata.xml
     https://jcenter.bintray.com/com/google/android/gms/play-services/
     https://repo1.maven.org/maven2/com/google/android/gms/play-services/maven-metadata.xml
     https://repo1.maven.org/maven2/com/google/android/gms/play-services/
     http://jzaccone.github.io/SlidingMenu-aar/com/google/android/gms/play-services/maven-metadata.xml
     http://jzaccone.github.io/SlidingMenu-aar/com/google/android/gms/play-services/
     https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/maven-metadata.xml
     https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/
     file:/Users/thatsme/android-sdks/extras/android/m2repository/com/google/android/gms/play-services/maven-metadata.xml
     file:/Users/thatsme/android-sdks/extras/android/m2repository/com/google/android/gms/play-services/
     file:/Users/thatsme/android-sdks/extras/google/m2repository/com/google/android/gms/play-services/maven-metadata.xml
     file:/Users/thatsme/android-sdks/extras/google/m2repository/com/google/android/gms/play-services/
 Required by:
     GA:app:unspecified

2 个答案:

答案 0 :(得分:0)

将此添加到清单

<application>
      ...
   <meta-data 
      android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version" />
</application>

答案 1 :(得分:0)

打开SDK Manager并检查您是否拥有所有必需的软件包:

  

要使用Google API进行开发,您需要Google Play服务   package:打开Extras目录并选择:

     
      
  • Google Repository
  •   
  • Google Play服务
  •   

参考http://developer.android.com/sdk/installing/adding-packages.html

然后:

  

要使您的应用可以使用Google Play服务API:

     
      
  1. 打开应用程序模块目录中的build.gradle文件。

  2.   
  3. 在最新版本的播放服务的依赖项下添加新的构建规则。例如:

    dependencies {
        compile 'com.google.android.gms:play-services:7.3.0'
    }
    
  4.   
  5. 保存更改,然后单击工具栏中的“使用Gradle文件同步项目”。

  6.   

参考:http://developer.android.com/google/play-services/setup.html#Setup