12

gefunden. Ich verwende das Android SDK 2.2.3. Ich folge einem Buch über die Programmierung von Android.Kein Ressourcenbezeichner für das Attribut 'layout_constraintLeft_toLeftOf' im Paket

Der Code ist:

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

ich versucht habe drei verschiedene Beispiele mit dem android.support.constraint.ConstraintLayout und in allen Fällen bekomme ich die gleiche Fehlermeldung:

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

Die build.gradle Datei enthält:

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

Was muss ich tun, um den Fehler zu beheben?

Ich habe den Fehler gegoogelt und konnte keinen Vorschlag finden, der den Fehler behebt.

Bitte helfen.

Antwort

27

ConstraintLayout ist nicht Teil von AppCompat. Es ist eine eigenständige Bibliothek.

In Abhängigkeit in Ihrer build.gradle Datei

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

und klicken Sync now.

Verwandte Themen