由于目标版本,Android Gradle 项目同步失败 [英] Android Gradle project sync failed due to target version
问题描述
由于 SDK 管理器中有新的 Android 6.0 API 可用,因此在应用程序级 build.gradle 文件中出现提示以进行更新
Since a new API of Android 6.0 is available in SDK Manager a hint was appeared in application level build.gradle file to update
来自
androidTestCompile 'com.android.support:support-annotations:22.0.1'
compile 'com.android.support:appcompat-v7:22.0.1'
到
androidTestCompile 'com.android.support:support-annotations:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
我还没有从 sdk manager for Android 6(API 23) 下载新的更新,但仍然更改了以下详细信息,如下所示,
I haven't downloaded new update from sdk manager for Android 6(API 23) yet but still changed the following details as shown below,
之前
compileSdkVersion 22
buildToolsVersion "22.0.1"
targetSdkVersion 22
androidTestCompile 'com.android.support:support-annotations:22.0.1'
compile 'com.android.support:appcompat-v7:22.0.1'
之后
compileSdkVersion 23
buildToolsVersion "23.0.0"
targetSdkVersion 23
androidTestCompile 'com.android.support:support-annotations:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
由于我还没有下载新的API 6.0,出现如下错误
As I haven't downloaded new API 6.0 yet, following error occurred
Error:Cause: failed to find target with hash string 'android-23' in: C:\Users\DRONE\AppData\Local\Android\sdk
所以现在我再次将应用程序级 build.gradle 文件中的设置更改为之前的设置,但错误并未得到解决.发生同样的错误.
So now again I changed the setting in application level build.gradle file as what it was before, but the error is not being resolved. Same error is occurring.
我现在如何解决这个问题?
How do I solve this now?
推荐答案
通常是没有 API 23 引起的.SDK更新到新版本后,即使你没有上传它,它也经常将build.gradle
重写为SDK提供的最高API版本.最简单的方法 - 下载 API 23.
Normally it is caused by not having API 23.
After updating the SDK to the newer version, it often rewrites build.gradle
to the highest API version SDK provided even if you didn't upload it.
The easiest way - download API 23.
这篇关于由于目标版本,Android Gradle 项目同步失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!