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

23

141

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

Neurogenic answered 23/6, 2016 at 12:51 Comment(2)
I was working with AS 2.2 P 3 and it was fineNeurogenic
I just updated to AS2.2-alpha7... and it started error-ing out on me too.Greywacke
M
331

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

Montsaintmichel answered 4/8, 2016 at 21:28 Comment(7)
For those who have these libraries installed but gradle is still complaining, check jmartinalonso's answer below. It is extending this answer.Klaraklarika
Note: Preferences is actually File > Settings on Windows.Giro
In my case I couldn't find AndroidSDK as mentioned here .So I executed ./sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4" from android-tools/bin.Ascent
Great helped me, but we need to sync and update both [ gradle and sdk tools versions]Sol
I'm running on Ubuntu, and my ~/Android/Sdk/extras/m2repository was owned by root:root. I chowned it to my user, and I could then update the library.Symploce
As of Android Studio 2.3.3 on Windows, the mouse clicks required are File-->Settings-->Appearance & Behavior-->System Settings-->Android SDK-->SDK Tools tab. Then check "ConstraintLayout for Android" and "Solver for ConstraintLayout." Finally, Build-->Rebuild ProjectManhunt
My current version is 3.0 i have tried your ways but its not solved :(Lowkey
T
132

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'
}
Trypanosomiasis answered 8/10, 2016 at 16:52 Comment(0)
L
15

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'

Landes answered 23/6, 2016 at 20:32 Comment(1)
Be careful with using 2.2.0-alpha3 there is a bug with Toolbar on Android 4.x #37812615Koval
T
12

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

Thyroiditis answered 21/11, 2016 at 13:27 Comment(0)
H
11
  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'
}
Hakeem answered 24/9, 2017 at 23:18 Comment(0)
C
8

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

Capitoline answered 23/6, 2016 at 22:39 Comment(1)
Thanks this worked for me. Gradle updated itself after popup but not the constraint dependencyGardel
B
6

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

Biased answered 25/10, 2016 at 16:30 Comment(1)
Yes I agreed with your answerQuartet
C
5

Alpha version is no longer available !

implementation 'com.android.support.constraint:constraint-layout:1.1.3'
Cabalist answered 3/10, 2019 at 13:2 Comment(2)
Use latest version of contraint-layoutHarley
Where would one add this line of code? I have latest android version 3.6 and I do not have a Support Repository option in SDK ToolsSkeptic
B
3

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

Billings answered 27/3, 2017 at 11:20 Comment(1)
I was stuck on this until I saw your post I needed a specific older version of these. Great tip!Mayemayeda
B
1

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

Butane answered 29/7, 2016 at 8:42 Comment(0)
G
1

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

Gertrude answered 15/9, 2016 at 7:54 Comment(0)
S
1

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'

Sedulity answered 3/11, 2016 at 19:36 Comment(0)
U
1

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

Underlying answered 24/2, 2017 at 21:28 Comment(0)
V
1

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()
    }
}
Veneering answered 7/5, 2018 at 17:38 Comment(0)
Y
1

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.

Youthen answered 17/10, 2018 at 6:15 Comment(0)
B
1

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'

Bases answered 23/11, 2020 at 14:30 Comment(0)
W
0

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.

Wristband answered 22/7, 2016 at 6:26 Comment(0)
C
0

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: Error:(30, 13) Failed to resolve: com.android.support.constraint:constraint-layout:1.0.0-alpha4

Cutout answered 2/10, 2016 at 9:34 Comment(0)
C
0

Its available in androidx as following package

implementation "androidx.constraintlayout:constraintlayout:2.0.0-alpha1"
Commingle answered 26/10, 2018 at 6:24 Comment(0)
R
0

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'

Romito answered 7/5, 2019 at 10:0 Comment(0)
R
0

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

compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
}
Registered answered 22/9, 2021 at 6:48 Comment(0)
B
-2

Similar issue solved by Reinstalling Android Studio.

Brutality answered 2/3, 2019 at 14:40 Comment(1)
I guess a simpler solution is expected.Raconteur
S
-4

enter image description here

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

Shackle answered 26/8, 2016 at 1:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.