Search code examples
androidandroid-studioandroid-gradle-pluginandroid-coordinatorlayout

Why CoordinatorLayout not found on my project


Before I published it here, I searched a lot, but I could not find a solution.

why CoordinatorLayout not found on my project ?

screenshot

enter image description here

gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.salah250.forvo"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:support-vector-drawable:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    //Material Design
    implementation 'com.android.support:design:27.1.1'
    //Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    //GSON
    implementation 'com.google.code.gson:gson:2.8.5'
    //Event Bus
    implementation 'org.greenrobot:eventbus:3.1.1'
    //Picasso
    implementation 'com.squareup.picasso:picasso:2.71828'
    //Butter knife
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    //Circle Image
    implementation 'de.hdodenhof:circleimageview:2.2.0'
}

I hope to find a solution to this problem..............................


Solution

  • If you checked the dependencies (com.android.support:appcompat-v7:27.1.1) and in the layout which starts by: androidx.coordinatorlayout It means you're still using Support Library dependencies but you are trying to use AndroidX CoordinatorLayout.

    Use Migrate to AndroidX from Refactor or, use Support Library CoordinatorLayout:

    <android.support.design.widget.CoordinatorLayout>
    </android.support.design.widget.CoordinatorLayout>
    

    Read: https://developer.android.com/jetpack/androidx/migrate