Gradle Sync failed could not find constraint-layout:1.0.0-alpha2

AndroidAndroid StudioGradleAndroid Constraintlayout

Android Problem Overview


Problem :

Error:Could not find com.android.support.constraint:constraint-layout:1.0.0-alpha2.
Required by:
myapp:app:unspecified

Background : Android Studio 2.2 P 1

Android Solutions


Solution 1 - Android

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.

Preferences

Solution 2 - Android

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.

enter image description here

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'
}

Solution 3 - Android

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'

Solution 4 - Android

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

enter image description here

Solution 5 - Android

  1. 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'
}

Solution 6 - Android

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

Solution 7 - Android

First I tried everything that I have read on stackoverflow...from updating gradle to XY version, to updating ConstraintLayout to XY version...I even update my SDK tools and Android Studio to the latest version...but nothing was working.

The only solution that worked for me was that I delete ConstraintLayout library from gradle and SDK, then I opened random xml layout and in Design view under Palette section search for ConstraintLayout. If you have successfully deleted library from your project then you will be able to install the library from there if you double clicked on ConstraintLayout element.

That has create next line in my app build.gradle:

'com.android.support.constraint:constraint-layout:1.0.0-beta1'

In my project build.gradle I have this:

classpath 'com.android.tools.build:gradle:2.2.2'

Android studio version 2.2.2

Solution 8 - Android

Alpha version is no longer available !

implementation 'com.android.support.constraint:constraint-layout:1.1.3'

Solution 9 - Android

Just to make sure that in studio version 2.3 you won't see a dropdown near constraint-layout in sdk tools, it will by default install the latest version

To get the desired version check the box saying show package details and boom you can now choose the desired version you want to install

Solution 10 - Android

gradle com.android.tools.build:gradle:2.2.0-alpha6

constraint layout dependency com.android.support.constraint:constraint-layout:1.0.0-alpha4

works for me

Solution 11 - Android

For me it was a completely different issue. When I installed constraint dependancy in SDK tools, the tools somehow wrote them into the wrong directory. That is

/home/${USER}/Android/Sdk/extras/+m2repository+/com/.../constraint

instead of

/home/${USER}/Android/Sdk/extras/+android+/+m2repository+/com/.../constraint

Remedy:

Just copy the 1.0.0-alpha* directories into the latter path

Solution 12 - Android

While updating SDK tools, a dilog box presented with Constraint layout version that is going to get installed. Note that and update your dependency based on that. In my case it was installing beta3.

I changed my dependency like below. After that it worked.

compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'

Solution 13 - Android

In my case, I had to remove the previous versions first and download the latest one instead. v1.0 stable was released on Feb 23rd. enter image description here

Solution 14 - Android

In my case, I had a multi-module project called "app" and "sdk". The "sdk" module is the one where I had added the constraint layout library. I got the error when I tried to incorporate "sdk" into a new multi-module project called "app2". The solution was to ensure I had added the Google Maven Repository to the project-level build.gradle file for "app2". The Google Maven Repository can be added by putting "google()" under allprojects.repositories in the project-level build.gradle file:

allprojects {
    repositories {
        jcenter()
        google()
    }
}

Solution 15 - Android

In my case, I was using AS 2.3 and I wanted to use the currently latest ConstraintLayout 1.1.3, but the latest version in my Preferences > Appearance & Behavior > System Settings > Android was 1.0.2.

To use ConstraintLayout 1.1.3, I updated my AS from 2.3 to currently latest 3.2.1, com.android.tools.build:gradle from 2.2.2 to 3.2.1, gradle from 3.3 to 4.6 and buildToolsVersion from 25.0.0 to 28.0.3.

I also added maven { url 'https://maven.google.com'; } to the Maven repositories in the project-level build.gradle file and that solved my problem.

Solution 16 - Android

Just as a heads up to those still searching for this.

ConstraintLayout 1.0.1 and lower have been deprecated by maven.

For a list of available constraint layouts that can be downloaded, see below:

https://maven.google.com/web/index.html?q=Constrain#com.android.support.constraint:constraint-layout

The easiest solution at the moment, is to change

implementation 'com.android.support.constraint:constraint-layout:1.0.0-beta1'

to

implementation 'com.android.support.constraint:constraint-layout:1.0.2'

Solution 17 - Android

I used com.android.support.constraint:constraint-layout:1.0.0-alpha2 with classpath 'com.android.tools.build:gradle:2.1.0', it worked like charm.

Solution 18 - Android

Not sure if I'm too late, but in case someone has still the error after an update of ConstraintLayout and Solver over the SDK Tools, maybe this solution could help: https://stackoverflow.com/questions/38450414/error30-13-failed-to-resolve-com-android-support-constraintconstraint-layo/39815613#39815613

Solution 19 - Android

Its available in androidx as following package

implementation "androidx.constraintlayout:constraintlayout:2.0.0-alpha1"

Solution 20 - Android

Update your constraint layout dependency to the relevant version from '1.0.0-alpha2'. In my case, I changed to the following. compile 'com.android.support.constraint:constraint-layout:2.0.0-alpha5'

Solution 21 - Android

I added the following script in build.gradle(app) under android & I was able to compile.

compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
}

Solution 22 - Android

Similar issue solved by Reinstalling Android Studio.

Solution 23 - Android

enter image description here

i'm try constraint layout dependency update available 1,and plugin gradle alpha-6,it worked

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCoolView Question on Stackoverflow
Solution 1 - AndroidgokhanakkurtView Answer on Stackoverflow
Solution 2 - AndroidjmartinalonsoView Answer on Stackoverflow
Solution 3 - AndroidJohnnyView Answer on Stackoverflow
Solution 4 - AndroidAnshul AgarwalView Answer on Stackoverflow
Solution 5 - AndroidRohanView Answer on Stackoverflow
Solution 6 - AndroidsvenView Answer on Stackoverflow
Solution 7 - AndroidBVanturView Answer on Stackoverflow
Solution 8 - AndroidTiago SimõesView Answer on Stackoverflow
Solution 9 - AndroidmadhurView Answer on Stackoverflow
Solution 10 - AndroidLukas LechnerView Answer on Stackoverflow
Solution 11 - AndroidPeter ChaulaView Answer on Stackoverflow
Solution 12 - AndroidSoftwareGuyView Answer on Stackoverflow
Solution 13 - AndroidmhdtoubanView Answer on Stackoverflow
Solution 14 - AndroidMichael OsofskyView Answer on Stackoverflow
Solution 15 - AndroidAllanView Answer on Stackoverflow
Solution 16 - AndroidRussyView Answer on Stackoverflow
Solution 17 - AndroidandroidStudView Answer on Stackoverflow
Solution 18 - AndroidCamino2007View Answer on Stackoverflow
Solution 19 - AndroidUzairView Answer on Stackoverflow
Solution 20 - AndroidVishudh SasidharanView Answer on Stackoverflow
Solution 21 - AndroidPavan PyatiView Answer on Stackoverflow
Solution 22 - AndroidspacedevView Answer on Stackoverflow
Solution 23 - AndroidqydqView Answer on Stackoverflow