1

Failed to sync Gradle Project ‚HelloGlass‘
Error: Cause: failed to find target with hash string 'Google Inc.: Glass Development Kit Preview:19' in D:\Project\Android-SDK

Strangly, this error didn’t appear 3 days ago when I last built the project. I haven’t changed anything or used Android Studio since then.

These are the steps that I’ve tried to solve the issue:

  • restarted Android Studio and tried to build again
  • made sure that both gradle and my project use the same path for the Android SDK
  • made sure that I have the Google Glass Development Kit Installed in the SDK Manager (and all other packages for API 19 as well), also deleted and re-installed it
  • installed the latest Build Tools via the SDK Manager and consequently changed buildToolsVersion „23.0.1“ to „23.0.2“ in my gradle file
  • Replaced 'com.android.tools.build:gradle:2.0.0-alpha3' in my top-level gradle file with 'com.android.tools.build:gradle:2.0.0-alpha6' since this is the latest version
  • in gradle-wrapper.properties changed this line distributionUrl=https://services.gradle.org/distributions/gradle-2.8-all.zip to this line: distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip and chose „use default gradle wrapper“ in the project options
  • cleared gradle caches in project/gradle and %HOME%/gradle
  • tried to build a new Google Glass Project from scratch in Android Studio – same problem

This is the relevant part of my gradle file:

android {
    compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.helloglass"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    ...

And my top-level gradle file:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
    }
}

I don’t know what else to do. Any help is greatly appreciated!

user3165984
  • 121
  • 2
  • 10

2 Answers2

0

I haven't found the reason for the problem, but after re-installing both Android Studio and Android SDK I can finally build the project.

user3165984
  • 121
  • 2
  • 10
  • In case anyone else is wondering how to fix this. If you get a new SDK probably will fix the problem straight away. Aparently the cause of the issue is that there are some duplicated packages on the SDK folders. More information about this error can be found https://code.google.com/p/android/issues/detail?id=199920 – Roberto Feb 02 '16 at 09:18
0

Replace

compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"

with

              compileSdkVersion 23

then rebuild the project, hope it will work

Bishnu Dudhraj
  • 277
  • 2
  • 7
  • 22