12

Android SDK 2.2.3을 사용하고 있습니다. Android 프로그래밍에 대한 책을 읽고 있습니다.패키지의 속성 'layout_constraintLeft_toLeftOf'에 대한 리소스 식별자가 없습니다.

코드는 다음과 같습니다

<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> 

나는 android.support.constraint.ConstraintLayout 세 가지 다른 예를 시도하고 모든 경우에 할에 저도 같은 오류 메시지가 :

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

build.gradle 파일에 포함 된 내용 :

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' 
} 

오류를 해결하려면 어떻게해야합니까?

나는 오류를 봤는데 오류를 해결하는 제안을 찾을 수 없습니다.

도와주세요.

답변

27

ConstraintLayout는 AppCompat의 일부가 아닙니다. 독립 실행 형 라이브러리입니다. 당신의 build.gradle 파일

compile 'com.android.support.constraint:constraint-layout:1.0.2' 

Sync now을 클릭에

추가 종속성.