Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Gradle project sync failed due to target version

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

FROM

androidTestCompile 'com.android.support:support-annotations:22.0.1' compile 'com.android.support:appcompat-v7:22.0.1' 

TO

androidTestCompile 'com.android.support:support-annotations:23.0.0'     compile 'com.android.support:appcompat-v7:23.0.0' 

I haven't downloaded new update from sdk manager for Android 6(API 23) yet but still changed the following details as shown below,

BEFORE

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' 

AFTER

    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' 

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 

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?

like image 787
Palak Avatar asked Aug 26 '15 14:08

Palak


People also ask

Why is my Gradle not syncing?

Missing files: There might also be missing files which are required to run Gradle. Installing them solves the issue instantly. Proxy servers: Even though proxy servers are becoming increasingly popular, we saw some cases where Gradle wasn't syncing on them properly. Disabling the proxy server resolves the issue.

How do I fix Gradle sync issues in IntelliJ?

We can configure the settings for how IntelliJ IDEA syncs with Gradle by pressing the settings icon in the Gradle tool window, and selecting Auto-Reload Settings. We can set IntelliJ IDEA to automatically reload the project after "Any changes" in the build script files, so changes are automatically reloaded.


2 Answers

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.

like image 116
Wernon Avatar answered Sep 28 '22 21:09

Wernon


I think it may caused by you don't have 23 API, Go to Tools > Android > SDK Manager and check to see if API-23 is installed.

like image 36
Kun Avatar answered Sep 28 '22 20:09

Kun