Ahmed Emad
Ahmed Emad

Reputation: 161

Android studio gradle (Error:Failed to resolve: com.android.support.constraint:constraint-layout-so)

Error:Failed to resolve: com.android.support.constraint:constraint-layout-solver:1.0.2

Install artifact and sync project
Open File
Show in Project Structure dialog

Upvotes: 16

Views: 33485

Answers (5)

Dyo Medio
Dyo Medio

Reputation: 799

You need to activate Auto Import Packages and Components to use, so On welcome to Android Studio Popup Window see on the bottom > click configure > preference or setting (on Windows OS) > Find Editor > General > Auto Import > Change Insert Imports on paste to All, and thick checkbox Add unambiguous import on the fly. And you also need to check installed SDK Platforms on your machine, position still on setting page, find Appearance and Behaviour > System Setting > Android SDK > and you need Pick Android 5.0 (Lollipop) until Android 7.0 (Nougat) the latest one if you prefer > click apply > And you will be asked to download > as all finish you will be find to go.

Upvotes: 1

Vishnu T S
Vishnu T S

Reputation: 3924

I have also faced the same error. I updated my android constraint-layout version to 1.0.1(com.android.support.constraint:constraint-layout:1.0.1) from 1.0.2 and it is working now.

build.gradle

 dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:26.+'
        compile 'com.android.support.constraint:constraint-layout:1.0.1'
        testCompile 'junit:junit:4.12'
    }

enter image description here

Upvotes: 4

faraz khonsari
faraz khonsari

Reputation: 1954

first add google maven repository in module level gradle file(important part)

repositories {
    maven {
        url 'https://maven.google.com'
    }
}

then add this line in dependencies:

compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support.constraint:constraint-layout-solver:1.0.2'

Upvotes: 15

Justin Pollard
Justin Pollard

Reputation: 6679

I encountered this problem as well. It was perplexing to me because the SDK manager showed both ConstraintLayout and its solver as installed. What I did to solve it was the following:

  1. Open the SDK manager (the Android Studio nav bar button with a downward facing arrow and a little Android head)
  2. Click the "SDK Tools" tab
  3. Uncheck boxes next to "ConstraintLayout for Android" and "Solver for ConstraintLayout"
  4. Click "Apply" and confirm that you want to uninstall those components
  5. When uninstallation is complete, recheck the boxes in step 3
  6. Click "Apply" and confirm that you want to reinstall the components

The next time you refresh your gradle projects, everything should work just fine!

Upvotes: 17

user7778785
user7778785

Reputation: 219

go to file>settings>Android sdk>sdk Tools>and update your support repository that fixed my problem

Upvotes: 21

Related Questions