【问题标题】:google play service error谷歌播放服务错误
【发布时间】:2016-01-15 08:00:49
【问题描述】:

我得到了以下错误

Error:(1, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in C:\Users\TARUN\Desktop\GingerBuds\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip

然后我改变了上面的gradle路径,然后出现了以下问题,

我在构建我的项目时遇到了这个异常。我重建并清理了项目并更新了 google-play-services ,然后我也得到了错误。谁能帮我解决这个问题。

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: C:\Users\TARUN\Desktop\Gingerbuds\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\jars\classes.jar (The system cannot find the path specified)

构建.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.kitchenvilla.gingerbuds"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 24
        versionName "1.2.2"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

android {
    useLibrary 'org.apache.http.legacy'
}
android {
    publishNonDefault true
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.mcxiaoke.volley:library:1.0.15'
    compile 'org.apmem.tools:layouts:1.10@aar'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.google.android.gms:play-services-maps:8.4.0'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.pkmmte.view:circularimageview:1.1'
    compile 'com.squareup.picasso:picasso:2.3.2'
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
}

【问题讨论】:

  • 你用的是eclipse还是android studio/
  • 我正在使用安卓工作室。
  • 发布你的 build.gradle
  • 更新了我的问题。请看一下。
  • 我更新了我的问题,请看一次。

标签: android google-play-services


【解决方案1】:

此错误已根据 Google 开发者博客修复:http://tools.android.com/tech-docs/new-build-system

2.0.0-alpha6 (2016/1/15)
Instant Run 
Fix alpha5 reported issues :
    - cannot build when importing play-services.

你应该更新 android gradle 工具版本

dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
}

【讨论】:

  • 如果你想要最新的构建工具,这就是你要走的路。 IMO 这应该是公认的答案,因为降级并不是一个持久的解决方案。
  • 如上所述添加依赖项后,我仍然收到以下消息Error:Cause: failed to find target with hash string 'Google Inc.:Google APIs:23' in: D:\Android\sdk <a href="openAndroidSdkManager">Open Android SDK Manager</a>
【解决方案2】:

在尝试打开由指定路径名表示的文件失败时引发此异常。

你可以使用

   compile 'com.google.android.gms:play-services:8.3.0'

更新您的类路径

 classpath 'com.android.tools.build:gradle:2.0.0-alpha2'

【讨论】:

  • 为这两个谷歌图书馆添加这个版本
  • 可以使用7.8.0版本。
  • kk,谢谢,我在努力
  • 你提到了类路径,实际上它解决了我的问题。
【解决方案3】:

这样就解决了

dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
    classpath 'com.google.gms:google-services:2.0.0-alpha2'
}

compile 'com.google.android.gms:play-services:8.3.0'

【讨论】:

  • 这是一种解决方法(通过使用旧版本),而不是解决方案。解决方案是使用 gradle 插件版本 2.0.0-alpha6 来解决这个问题,正如@ArL 所回答的那样。
【解决方案4】:

首先,您必须启动 sdk 管理器并下载并安装位于“extras”下的以下文件:Android 支持存储库Google play 服务 , Google 存储库。 然后添加compile 'com.google.android.gms:play-services:8.4.0' 给你毕业

然后单击“使用 Gradle 文件同步项目”按钮就可以了:

Tools -> Android -> Sync Project with Gradle Files

如果失败,请尝试运行“重建项目”:

Build -> Rebuild Project

【讨论】:

  • 查看此解决方案以升级您的 gradle 版本stackoverflow.com/a/17648742/4919237
  • @ArL 发布了解决方案。同步和重建不是解决方案,甚至不是解决方法。
【解决方案5】:

在项目级 gradle 文件中将 gradle 版本更新为 alpha9

classpath 'com.android.tools.build:gradle:2.0.0-alpha9'

【讨论】:

    【解决方案6】:

    我试图将 admob 广告导入到我正在制作的新应用程序中,但遇到了这个问题......我找到了解决方案,即 StartAppInApp 文件位于错误的位置或不存在...... ..我的应用程序需要将 StartAppInApp-3.1.1.jar 文件放在 libs 文件夹中,当我查看我的应用程序时,根本没有 libs 文件夹......

    打开您的主应用文件夹...然后单击应用程序,您应该有 3 个文件夹.... src ... build .... 和 libs .....

    在我的情况下,没有 libs 文件夹.....所以我创建了 libs 文件夹,然后从我拥有的另一个 android 项目中复制了 StartAppInApp-3.1.1.jar 文件并将其粘贴到新项目中我在当前项目中创建的 libs 文件夹......现在错误已经消失了!

    我也确保包括

    编译文件('libs/StartAppInApp-3.1.1.jar')

    在我的应用程序 gradle 文件的依赖项中

    不确定这是否是一个可靠的答案,但如果有人遇到此问题,请仔细检查您的 StartAppInApp-3.1.1.jar 位置和版本并检查您的 gradle 依赖项

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-08
      • 2017-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-18
      • 2014-05-23
      相关资源
      最近更新 更多