Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 520
neutron Avatar asked Oct 20 '16 17:10

neutron


2 Answers

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'

like image 68
marlonpya Avatar answered Nov 16 '22 18:11

marlonpya


Or update your dependency to:

compile 'com.android.support.constraint:constraint-layout:latest_version'
like image 4
P.Lorand Avatar answered Nov 16 '22 20:11

P.Lorand