android - Google Play 服务无法使用 Gradle 进行编译

标签 android gradle google-play-services

我尝试使用 Gradle 及其 gradlew.bat 文件编译一个库,但始终失败。 它显示以下消息:

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':library'.

    Could not resolve all dependencies for configuration ':library:_debugCompile'.

    Could not find com.google.android.gms:play-services:3.1.36. Required by: com.google.maps.android:library:0.3-SNAPSHOT

我已经修改了 gradle 文件以将其指向正确的方向:

List myDependencies = ["com.google.android.gms:play-services:3.1.36",
        fileTree (dir: 'c://Program Files/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services/3.1.36/', includes: ['*.jar'])]

dependencies {
    compile myDependencies
}

我已经安装了 Google 存储库和 Google 支持存储库。

我使用 IntelliJ IDEA。

我还应该尝试什么?

最佳答案

我将 google-play-services.jar 文件复制到我的项目中,并将 build.gradle 文件更改为:

dependencies {
   compile files('google-play-services.jar')
}

现在可以正常工作了。

关于android - Google Play 服务无法使用 Gradle 进行编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21392243/

相关文章:

android - keytool 和 openssl 证书指纹不匹配

java - OnListItemClick 只工作一次

gradle - maven 或 gradle : how to find the dependencies developer/provider(s)

android - 谷歌云端硬盘 SDK 和 API

android - 如何在android中使用openstreetmap按经纬度获取地址

android - 在 Android 中关闭或取消对话框有什么区别?

java - 如何在Java中使用Gradle Test类的afterSuite方法?

java - 如何使用 Gradle 在 Spring Boot 中覆盖来自 Thymeleaf 1.5.8.RELEASE 的传递依赖 Groovy 版本

java - Google Play 游戏服务中基于套接字与不可靠的消息传递

android-gradle-plugin - React-Native Android Build Failure : Execution failed for task ':app:processDebugResources' . 资源处理失败