Ich verwende das Android SDK 2.2.3. Ich verfolge ein Buch zur Programmierung von Android.
Der Code lautet:
<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 habe drei verschiedene Beispiele mit Android.support.constraint.ConstraintLayout ausprobiert und in allen Fällen erhalte ich dieselbe 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
ConstraintLayout
ist nicht Teil von AppCompat. Es ist eine eigenständige Bibliothek.
Fügen Sie Ihrer build.gradle
-Datei eine Abhängigkeit hinzu
compile 'com.Android.support.constraint:constraint-layout:1.0.2'
und klicken Sie auf Sync now
.
Ich hatte das gleiche Problem, indem ich diese Zeile zu build.gradle (Modul-App) hinzufügte. Das Problem wurde behoben .. _. Compile 'com.Android.support.constraint: constraint-layout: 1.1.0-beta3'