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:\\User
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.
It worked for me by changing compileSdkVersion
to 24 and targetSdkVersion
to 24 and change compile
to com.android.support:appcompat-v7:24.1.0
There are 2 solutions to this issue:
1) Download the relevant Android SDK via Tools -> Android -> SDK Manager -> SDK Tools (ensure you have 'Show Package Details') checked. Your case would be Android 6.0 (Marshmallow / API level 21)
2) Alternatively, open your build.gradle
file and update the following attributes :
compileSdkVersion
buildToolsVersion
targetSdkVersion
either to the most recent version of the Android API that you have installed / another installed version you'd like to use (although I'd always recommend going with the latest version for the usual reasons: bug fixes etc.)
If you're following step 2 it's also important that you remember to update the Android support library version if your app is using it. This can be found in the dependencies
section of your build file and looks something like this:
compile 'com.android.support:appcompat-v7:27.0.2'
(replace 27.0.2
with the most recent support library version for the API level you intend to use with your app)
For me the problem was in that I wrote compileSdkVersion '23' instead of 23. The quotes were the problem.
I had this issue when using windows. It turned out that the SDK location in my profiles was the issue. So I had to relocate my SDK folder to documents and then it worked.
Ensure the IDE recognizes that you have the package. It didn't on mine even after downloading 28, so I uninstalled then reinstalled it after realizing it wasn't showing up under File-Project Structure-Modules-App as a choice for SDK.
On top of that, you may want to change your build path to match.
Slightly related, the latest updates seem able to compile when I forced an update all the way to 28 for CompileSDK, and not just up to the new API 26 min requirement from Google Play. This is related to dependencies though, and might not affect yours