Reputation: 21
Gradle sync failed: Cause: failed to find target with hash string 'android-18' in: C:\Users\Android\sdk Consult IDE log for more details
I am finding this error every time, when importing a project into android studio.
Upvotes: 2
Views: 9080
Reputation: 865
For handling this issue, you have to update the gradle version in build.gradle of your project to latest gradle version of your android studio. After that if android studio terminal shows any of the following then 1) install the missing platform(s) or 2) install build tools or 3) Fix Gradle wrapper and re-import project do that and sync your project.
Upvotes: 0
Reputation: 29285
I am finding this error every time, when importing a project into android studio.
For addressing this issue, you may want to change SDK level of the imported project to whatever you'd like. (However you should mak sure your chosen SDK level meets features used by the library)
For this, you should open build.gradle
file of that project and change SDK level there.
defaultConfig {
minSdkVersion 4
targetSdkVersion /* SDK LEVEL */
}
Another option would be installing SDK level 18 via SDK manager.
Upvotes: 1
Reputation: 15775
Go into the Android SDK manager and install the platform SDK for API 18. Or, go into the project settings and change the target API and build tools versions to be what you already have installed.
Upvotes: 2