Android Studio - Error: Failed to resolve: com.android.support.constraint:constraint-layout:1.0.0-alpha1
Asked Answered
F

3

7

Screen Shot #1 - Android Studio Project Gradle Build View

Screen Shot #2 - Android Studio Project Gradle Sync View

Going through the "Android Studio 2.2 Development Essentials book" and following along with the tutorial in chapter 3. Everything was OK until I completed a task in the Development Essentials book (chapter 3, page 24 in book) that said,

As we can see from the component tree hierarchy, the user interface layout consists of a layout parent with a single child in the form of a TextView object. If Android Studio has used a RelativeLayout manager for the project, the first step is to convert it to a ConstraintLayout. ConstraintLayout is a new and flexible layout manager that is used in most projects in this book. To achieve this conversion, right-click on the content_android_sample entry in the Component Tree and select the Convert RelativeLayout to ConstraintLayout menu option as shown below:

Upon completion of the above quoted tutorial task (in chapt. 3 of the Development Essentials book), an error was presented that said:

Error: Failed to resolve: com.android.support.constraint:constraint-layout:1.0.0-alpha1

Also, a rendering error was listed as well that said:

Rendering Problems The following classes could not be found: - android.support.constraint.ConstraintLayout (    Add constraint-layout library dependency to the project, Fix Build Path, Edit XML, Create Class)

Any thoughts on how to fix this? Please see screen shots attached (above). I'm new to Android Studio.

Thank you very much for your time.

I am using the following OS and Android Studio version below:

Win7 professional 64 bit OS

Android Studio 2.2

Build# AI-145,3330264, Built on October 6, 2016

Fluorometer answered 20/10, 2016 at 17:36 Comment(0)
A
22

You need add check in..

exist a icon with name "SDK Manager" just click

open Settings -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Tools

And in this dialog add:

  • ConstraintLayout for Android
  • Solver for ConstrainLayout

enter image description here

Then, here only you need close and open Android Studio.

Maybe only you can update to:

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

Aquilar answered 26/10, 2016 at 17:25 Comment(1)
Thank you for your kind help. Had to delay my project and hope to restart it soon.Fluorometer
C
4

Or update your dependency to:

compile 'com.android.support.constraint:constraint-layout:latest_version'
Cowans answered 7/6, 2017 at 11:21 Comment(2)
That depends on the versions installed on the local machine.Microminiaturization
Thanks for your help but I had to delay my project. Will notify you when I start the project again.Fluorometer
L
0

This should solve your error. Go to your build.gradle and change your implementation 'com.android.support.constraint:constraint-layout:1.0.0-beta7' to implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta7' or to any latest

Laith answered 25/6, 2020 at 14:39 Comment(1)
Thank you. Had to delay my project. Will pick up this thread again when I restart the project. Thanks again for you help.Fluorometer

© 2022 - 2024 — McMap. All rights reserved.