Java 错误:原因:无法在以下位置找到带有哈希字符串 'Google Inc.:Google APIs:23' 的目标:E:\AndroidStudio\SDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35450417/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error:Cause: failed to find target with hash string 'Google Inc.:Google APIs:23' in: E:\AndroidStudio\SDK
提问by x10sion
I have the above error and have no clue why I still have it. I have reinstalled API 23 numerous times and done googling and the only fix I found was to reinstall the API but still have the issue.
我有上述错误,不知道为什么我仍然有它。我已经多次重新安装 API 23 并进行了谷歌搜索,我发现的唯一解决方法是重新安装 API,但仍然存在问题。
Does anyone have a fix for it?
有没有人有解决办法?
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'
}
采纳答案by Vasily Kabunov
Try to use compileSdkVersion 23
instead of compileSdkVersion 'Google Inc.:Google APIs:23'
尝试使用compileSdkVersion 23
代替compileSdkVersion 'Google Inc.:Google APIs:23'
回答by brahmy adigopula
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>
when i have been importing the proj of eclipse into android adt i faced same problem.but i rectrify throug the following content changing which is in gradle.build file.i.e. { compileSdkVersion 23 targetsdkVersion"23.0.1".}
当我将 eclipse 的 proj 导入到 android adt 时,我遇到了同样的问题。但我纠正了以下内容更改 gradle.build file.ie { compileSdkVersion 23 targetsdkVersion"23.0.1".}
回答by winchella
I got this error when trying to build a project on Windows that was originally built on Ubuntu. If you're not sure which build.gradle file is causing it and the project has multiple modules, do a project search for "compileSdkVersion."
尝试在最初在 Ubuntu 上构建的 Windows 上构建项目时遇到此错误。如果您不确定是哪个 build.gradle 文件导致它并且项目有多个模块,请在项目中搜索“compileSdkVersion”。
Windows expects: compileSdkVersion 'Google Apis:Google Apis:23'
Windows 期望: compileSdkVersion 'Google Apis:Google Apis:23'
Ubuntu expects: compileSdkVersion "Google Inc.:Google APIs:23"
Ubuntu 期望: compileSdkVersion "Google Inc.:Google APIs:23"
回答by Kushal
Main module
or any library
must be using 'Google Inc.:Google APIs:23'
which is not installed in SDK. So try to change it and compile
主要module
或任何library
必须使用'Google Inc.:Google APIs:23'
的未安装在 SDK 中。所以尝试改变它并编译
Change : compileSdkVersion 'Google Apis:Google Apis:23'
改变 : compileSdkVersion 'Google Apis:Google Apis:23'
To : compileSdkVersion 23
(You should have android-23 installed in SDK)
To :(compileSdkVersion 23
你应该在SDK中安装了android-23)
回答by Luky
I got this error too, when i imported eclipse project to android studio. So i just did a little search "Edit -> Find -> Find in path" for "APIs 23" And i did replace (compileSdkVersion 'Google Inc.:Google APIs:23') in "Build.gradle" withe (compileSdkVersion 24). I think it should works. Good luck
当我将 eclipse 项目导入到 android studio 时,我也遇到了这个错误。所以,我只是做了一点搜索“编辑- >查找- >查找路径”为“ API的23”,我并更换(compileSdkVersion“谷歌Inc.:Google的API:23”)在“的build.gradle”枝条(compileSdkVersion 24)。我认为它应该有效。祝你好运
回答by Robin
You can create a new project
and see what's written in this project's 'build.gradle'.For example it is 'compileSdkVersion 25',then change your target project to 'compileSdkVersion 23'.
您可以创建一个new project
并查看该项目的'build.gradle'中写的内容。例如它是'compileSdkVersion 25',然后将您的目标项目更改为'compileSdkVersion 23'。
回答by pedda
I am using Ubuntu ,and I had the same issue. The accepted answer did not work for my version of Android Studio (2.3.3).
我正在使用 Ubuntu,我遇到了同样的问题。接受的答案不适用于我的 Android Studio (2.3.3) 版本。
I had to import an Eclipse webapp project for Android SDK 15, and did receive the same message. The solution that worked for me was the following:
我必须为 Android SDK 15 导入一个 Eclipse webapp 项目,并且确实收到了相同的消息。对我有用的解决方案如下:
- Download the correct version of the Android SDK (version 15 in my case)
- Use the name of the directory folder (in my case "android-15" stored in my home folder at
"~/[user_xxx]/Android/Sdk/platforms/"
. - Edit the line in the gradle script in my case to : compileSdkVersion 'android-15'
- 下载正确版本的 Android SDK(在我的例子中是版本 15)
- 使用目录文件夹的名称(在我的例子中为“android-15”,存储在我的主文件夹中,位于
"~/[user_xxx]/Android/Sdk/platforms/"
. - 在我的例子中,将 gradle 脚本中的行编辑为:compileSdkVersion 'android-15'