简体   繁体   中英

Android Studio: Failed to sync Gradle project

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.

进入Android SDK管理器并为API 18安装平台SDK。或者,进入项目设置并更改目标API和构建工具的版本,使其与您已经安装的版本相同。

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM