【问题标题】:Error:Cause: failed to find target with hash string 'Google Inc.:Google APIs:23' in: E:\AndroidStudio\SDK错误:原因:在 E:\AndroidStudio\SDK 中找不到带有哈希字符串“Google Inc.:Google APIs:23”的目标
【发布时间】:2016-05-28 18:52:15
【问题描述】:

我有上述错误,但不知道为什么我仍然有它。我已经多次重新安装 API 23 并进行了谷歌搜索,我发现的唯一解决方法是重新安装 API,但仍然存在问题。

有人解决了吗?

        apply plugin: 'com.android.application'

    android {
      compileSdkVersion 'Google Inc.:Google APIs:23'
      buildToolsVersion '23.0.2'

      defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
      }

      lintOptions {
        disable 'InvalidPackage'
      }


      buildTypes {
        release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
      }
    }

    dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:23.1.1'
      compile 'com.android.support:design:23.1.1'
      compile 'me.neavo:volley:2014.12.09'
      compile 'com.google.code.gson:gson:2.5'
      compile 'com.jakewharton:butterknife:7.0.1'
      compile 'com.android.support:support-v4:23.1.1'
    }

【问题讨论】:

  • 发布你的 build.gradle

标签: java android android-studio


【解决方案1】:

尝试使用compileSdkVersion 23 而不是compileSdkVersion 'Google Inc.:Google APIs:23'

【讨论】:

  • 我无法进行同步,所以我必须退出并再次打开它,然后才能进行同步。错误是一样的
  • 我 100% 确定此修复程序可以解决您的问题。我尝试将您的字符串 compileSdkVersion 'Google Inc.:Google APIs:23' 复制到我的项目 build.gradle 并遇到同样的错误。尝试清理并重建您的项目
  • 即使在更改之后,我得到的错误是错误:原因:未能找到带有哈希字符串'23'的目标:
  • 你复制这个字符串compileSdkVersion 23。您可能会使用compileSdkVersion '23'(23 带有撇号),这是不正确的。
  • 啊翻转!金发碧眼的时刻!感谢一家工作的工厂!奇怪的是,compileSdkVersion 'Google Inc.:Google APIs:23' 在我的 Mac 笔记本电脑上工作正常,我在 Windows 电脑上工作并从 GIT 下载了与我的笔记本电脑工作相同的代码,但在这里失败了。再次感谢
【解决方案2】:

我在尝试在 Windows 上构建最初在 Ubuntu 上构建的项目时遇到此错误。如果您不确定是哪个 build.gradle 文件导致它并且项目有多个模块,请在项目中搜索“compileSdkVersion”。

Windows 期望:compileSdkVersion 'Google Apis:Google Apis:23'

Ubuntu 期望:compileSdkVersion "Google Inc.:Google APIs:23"

【讨论】:

  • 非常感谢!你救了我:)
【解决方案3】:

主module 或任何library 必须使用未安装在SDK 中的'Google Inc.:Google APIs:23'。所以尝试改变它并编译

更改:compileSdkVersion 'Google Apis:Google Apis:23'

收件人:compileSdkVersion 23(您应该在 SDK 中安装了 android-23)

【讨论】:

    【解决方案4】:

    当我将 eclipse 项目导入到 android studio 时,我也遇到了这个错误。 所以我只是对“APIs 23”做了一点搜索“Edit -> Find -> Find in path”然后我确实替换了(compileSdkVersion 'Google Inc.:Google APIs:23')在“Build.gradle”中(compileSdkVersion 24 em>)。 我认为它应该有效。 祝你好运

    【讨论】:

      【解决方案5】:
      Error:Cause: failed to find target with hash string 'Google Inc.:Google APIs:17' in: C:\Users\brahmaiah\AppData\Local\Android\Sdk
      

      Open Android SDK Manager</a>
      

      当我将 eclipse 的项目导入 android adt 时,我遇到了同样的问题。但是我通过 gradle.build 文件中的以下内容更改来纠正。 { compileSdkVersion 23 目标dkVersion“23.0.1”。}

      【讨论】:

        【解决方案6】:

        你可以创建一个new project,看看这个项目的'build.gradle'里面写了什么。比如'compileSdkVersion 25',然后把你的目标项目改成'compileSdkVersion 23'。

        【讨论】:

          【解决方案7】:

          我使用的是 Ubuntu,我遇到了同样的问题。接受的答案不适用于我的 Android Studio 版本(2.3.3)。

          我必须为 Android SDK 15 导入一个 Eclipse webapp 项目,并且确实收到了相同的消息。对我有用的解决方案如下:

          1. 下载正确版本的 Android SDK(在我的例子中是 15 版)
          2. 使用目录文件夹的名称(在我的例子中,“android-15”存储在我的主文件夹"~/[user_xxx]/Android/Sdk/platforms/"。
          3. 在我的例子中将 gradle 脚本中的行编辑为: compileSdkVersion 'android-15'

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2023-03-19
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2016-01-24
            • 1970-01-01
            相关资源
            最近更新 更多