android...协调器布局错误

android...coordinatorlayout Error

我安装了 Android Studio 并想制作新项目,但我在设计页面上收到 android...协调器布局错误。

我的IDE状态: 使用最新的构建工具, IDE 是最新的, 对项目使用 android 4.0 并安装了 4.0。

我的 styles.xml 文件:

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

Here is picture about that error

使用gradle4.9

按需配置,关闭

gradle 插件 3.1.4

文件无效Cache/restart

与 gradle

同步项目

建设

该错误可能是因为您没有包含 Constraintlayout 对等级的依赖性。

将 ConstraintLayout 添加到您的项目

要在您的项目中使用 ConstraintLayout,请按以下步骤操作:

确保您在模块级 build.gradle 文件中声明了 maven.google.com 存储库:

repositories {
    google()
}

将库作为依赖项添加到同一个 build.gradle 文件中,如下例所示。请注意,最新版本可能与示例中显示的不同:

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
}

在工具栏或同步通知中,单击将项目与 Gradle 文件同步。 现在您已准备好使用 ConstraintLayout 构建布局。

您可以在以下 link.

中找到更多文档

https://developer.android.com/training/constraint-layout/

希望对你有帮助