failed to find target with hash string android-23

Al Lelopath picture Al Lelopath · Oct 29, 2015 · Viewed 161.8k times · Source

When trying to build OpenStreetMapView from git://github.com/osmdroid/osmdroid, I get this error:

failed to find target with hash string android-23: D:\Users\myusername\AppData\Local\Android

How can I fix this? Previous questions similar to this suggest checking that android 23 is not installed, but in my case, it is.

Below is some pertinent info:

ANDROID_HOME is D:\Users\myusername\AppData\Local\Android\sdk

D:\Users\myusername\AppData\Local\Android\sdk\platforms\ contains the directory \android-23\, (as well as android-19, android-21, android-22, android-MNC)

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "org.osmdroid.example"
        minSdkVersion 8
        targetSdkVersion 23
        versionCode 16
        versionName "4.4-SNAPSHOT"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'

    }
    lintOptions {
        abortOnError false
    }
}


dependencies {
    compile 'android.support:compatibility-v4:23+'
    compile project(':osmdroid-android')
    //compile 'org.osmdroid:osmdroid-third-party:4.4-SNAPSHOT'
}

I tried changing targetSdkVersion and compileSdkVersion to 22. This causes the error message to change to "android-22" instead of "android-23".

SDK Manager: enter image description here

Answer

htafoya picture htafoya · Jun 30, 2016

In my case, clearing caché didn't work.

On SDK Manager, be sure to check the box on "show package descriptions"; then you should also select the "Google APIs" for the version you are willing to install.

Install it and then you should be ok