Palak Palak - 1 year ago 126
Android Question

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


androidTestCompile ''
compile ''


androidTestCompile ''
compile ''

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 ''
compile ''


compileSdkVersion 23
buildToolsVersion "23.0.0"
targetSdkVersion 23
androidTestCompile ''
compile ''

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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download