To work with ConstraintLayout, you need Android Studio Version 2.2 or newer and have at least version 32 (or higher) of Android Support Repository.

  1. Add the Constraint Layout library as a dependency in your build.gradle file:
dependencies {
   compile ''
  1. Sync project

To add a new constraint layout to your project:

  1. Right-click on your module’s layout directory, then click New > XML > Layout XML.
  2. Enter a name for the layout and enter "" for the Root Tag.
  3. Click Finish.

Otherwise just add in a layout file:

<?xml version="1.0" encoding="utf-8"?>