Search code examples
androidandroid-coordinatorlayout

android...coordinatorlayout Error


I installed Android Studio and wanted to make new project but im getting android...coordinatorlayout error on Design page.

My IDE Status: Using latest build tools, IDE is up to date, Using android 4.0 for project and 4.0 is installed.

My styles.xml file:

<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


Solution

  • that mistake can be because you haven't included Constraintlayout's dependency on the grade.

    Add ConstraintLayout to your project

    To use ConstraintLayout in your project, proceed as follows:

    Ensure you have the maven.google.com repository declared in your module-level build.gradle file:

    repositories {
        google()
    }
    

    Add the library as a dependency in the same build.gradle file, as shown in the example below. Note that the latest version might be different than what is shown in the example:

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

    In the toolbar or sync notification, click Sync Project with Gradle Files. Now you're ready to build your layout with ConstraintLayout.

    You can find more documentation in the following link.

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

    I hope it helps