How To Resolve Errors When Change SDK Level In Android Studio

When you add a new dependency library in android project, you may find it need higher android sdk level such as version 27 or higher to compile and run. So you should change the project sdk version to fit the needs in such case.

1. New Android Sdk File Do Not Exist In Local Folder.

We have introduced how to change android project sdk version in article How To Change Minimum Sdk Version In Android Studio. But when the new version is higher, you may encounter below errors in android studio.

Failed to find target with hash string’android-27′ in : C:\Users\Jerry\AppData\Local\Android\Sdk

change android studio sdk version in build gradle file

This means you do not have the required version related android sdk installed in your local Sdk directory, just click the blue link Install missing platform(s) and sync project under the error message and wait for android studio to download and install the new sdk files. When you see below popup window, that means the download and install successfully. Click Finish button to complete the install.

install not exist android sdk in local directory

2. Failed To Resolve Dependent Support Library Error.

After install the new sdk, you may find exist dependency library will not be compatible with new sdk like below error messages.

Error:(29, 13) Failed to resolve:

Error:(33, 13) Failed to resolve:

exist dependency library do not compact with new android sdk version

To resolve above error, you need do below two things.

  1. Add below content in build.gradle file, because from android sdk version 26, it require android support libraries to be downloaded from google maven repository, so add maven section with url “”.
    allprojects {
        repositories {
            maven {
                url ""

    add android support library download maven repository info

  2. Go to google android support library package page.
  3. Search the not compatible library by name and get the latest version in above page.
    find android support library latest version
  4. Use the new version in your build.gradle file. Click Sync Now or Try Again in android studio top right corner. After sync the android project will build successfully.

0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest Most Voted
Inline Feedbacks
View all comments

how can i solve these error please?

Failed to open zip file.
Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
Re-download dependencies and sync project (requires network)

Would love your thoughts, please comment.x