Класс MotionLayout не найден или атрибут layoutDescription не найден - PullRequest
0 голосов
/ 23 января 2020

Я пытаюсь следовать учебнику по Google для MotionLayout и, похоже, не могу построить проект или даже найти класс.

Вот xml

<androidx.constraintlayout.motion.widget.MotionLayout
    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:layout_width="match_parent"
    android:layout_height="match_parent" 
    app:layoutDescription="@xml/step1_completed">

<ImageView
        android:id="@+id/red_star"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/ic_star_outline"
        android:tint="?colorSecondary"
        android:contentDescription="@string/star"
        android:layout_marginTop="30dp"
        android:layout_marginStart="30dp"
        android:layout_marginBottom="30dp"
        android:layout_marginEnd="30dp"/>

</androidx.constraintlayout.motion.widget.MotionLayout>

вот зависимости

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta3'
    api 'com.google.android.material:material:1.2.0-alpha03'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

а вот что я получаю при попытке запустить

AAPT: error: attribute layoutDescription (aka com.google.samples.motionlayoutcodelab:layoutDescription) not found.

Спасибо

1 Ответ

1 голос
/ 23 января 2020

Используйте версию зависимости AndroidX:

implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...