Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No resource identifier found for attribute 'layout_constraintLeft_toLeftOf' in package

I am using the Android SDK 2.2.3. I am following a book on programming Android.

The code is:

<android.support.constraint.ConstraintLayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/activity_main"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="eu.a123sandberg.webview.MainActivity"     tools:layout_editor_absoluteX="0dp"     tools:layout_editor_absoluteY="81dp">      <WebView         android:layout_width="384dp"         android:layout_height="511dp"         tools:layout_editor_absoluteX="0dp"         tools:layout_editor_absoluteY="0dp"         app:layout_constraintLeft_toLeftOf="@+id/activity_main"         tools:layout_constraintLeft_creator="0"         app:layout_constraintTop_toTopOf="@+id/activity_main"         tools:layout_constraintTop_creator="0"         app:layout_constraintRight_toRightOf="@+id/activity_main"         tools:layout_constraintRight_creator="0"         app:layout_constraintBottom_toBottomOf="@+id/activity_main"         tools:layout_constraintBottom_creator="0"         />  </android.support.constraint.ConstraintLayout> 

I have tried three different examples with the android.support.constraint.ConstraintLayout and in all cases do I get the same error message:

Error:(13) No resource identifier found for attribute 'layout_constraintLeft_toLeftOf' in package 'eu.a123sandberg.webview' 

The build.gradle file contains:

apply plugin: 'com.android.application'  android {     compileSdkVersion 25     buildToolsVersion "25.0.2"     defaultConfig {         applicationId "eu.a123sandberg.webview"         minSdkVersion 21         targetSdkVersion 25         versionCode 1         versionName "1.0"                                                                                   testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-                   android.txt'), 'proguard-rules.pro'         }      } }  dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     androidTestCompile('com.android.support.test.espresso:espresso-            core:2.2.2', {     exclude group: 'com.android.support', module: 'support-annotations'     })     compile 'com.android.support:appcompat-v7:25.1.1'     testCompile 'junit:junit:4.12' } 

What do I have to do to resolve the error?

I have googled the error and not been able to find a suggestion that resolves the error.

Please help.

like image 838
Jorgen Sandberg Avatar asked Feb 24 '17 12:02

Jorgen Sandberg


2 Answers

ConstraintLayout is not part of AppCompat. It's a standalone library.

Add the dependency in your build.gradle file

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

and click Sync now.

like image 166
Akash Patel Avatar answered Sep 19 '22 22:09

Akash Patel


I had the same problem, adding this line to build.gradle(module app) solved it.

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

like image 35
Ivon Ivonjoe Ivonjoee Avatar answered Sep 18 '22 22:09

Ivon Ivonjoe Ivonjoee