Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

failed to find target with hash string android-23

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

like image 271
Al Lelopath Avatar asked Oct 29 '15 14:10

Al Lelopath


3 Answers

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

like image 132
htafoya Avatar answered Oct 10 '22 08:10

htafoya


In Android Studio File -> Invalidate Caches/Restart solved the issue for me.

like image 21
Mohammed Ali Avatar answered Oct 10 '22 08:10

Mohammed Ali


The answer to this question.

Gradle gets stupid from time to time and wiping out the cache is the only solution that I've found. You'll find a hidden .gradle folder under your user home folder and another one wherever the checkout location is for osmdroid.

like image 17
Al Lelopath Avatar answered Oct 10 '22 09:10

Al Lelopath