Support libraries for ConstraintLayout
could not be installed/updated.
Just open Preferences
> Appearance & Behavior
> System Settings
> Android
and move to SDK Tools
tab. Check the following fields and install.
In my case, that support libraries for ConstraintLayout were installed, but I was adding the incorrect version of ConstraintLayout Library in my build.gradle file. In order to see what version have you installed, go to Preferences
> Appearance & Behavior
> System Settings
> Android SDK
. Now, click on SDK Tools
tab in right pane. Check Show Package Details and take note of the version.
Finally you can add the correct version in the build.gradle
file
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
testCompile 'junit:junit:4.12'
}
The fix is to update the android gradle plugin in your build.gradle.
This should work: classpath 'com.android.tools.build:gradle:2.2.0-alpha2'
Or you can use the latest: classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
My problem was, that the SDK Tools updated it to the latest version, in my case it was 1.0.0-alpha9, but in my gradle dependency was set to
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8' So, you can change your gradle build file to
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9' Or you check "Show package details" in the SDK Tools Editor and install your needed version. See screenshow below. Image of SDK Tools
Ensure you have the maven.google.com repository declared in your module-level build.gradle file
repositories {
maven {
url 'https://maven.google.com'
}
}
2.Add the library as a dependency in the same build.gradle file:
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
I updated my android gradle plugin to 2.2.0-alpha4
and constraint layout dependency to 1.0.0-alpha3
and it seems to be working now
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With