I am getting the following error while building the project. haven\'t used CoordinatorLayout in this project. just added as a dependency in build.gradle :
I am usin
I faced the same problem,
I added android support design dependencies to the app level build.gradle
Add following:
implementation 'com.android.support:design:27.1.0'
in build.gradle. Now its working for me.
I also faced same problem. But then I realised that the versions I am using of support libraries was not same.
Once I made it same, the error gone.
In your case
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.0.2'
are not same, so you just downgraded appcompat to
implementation 'com.android.support:appcompat-v7:27.0.2'
hence, your problem solved.
But you could also have solved if you could have upgraded support design version to
implementation 'com.android.support:design:27.1.0'
Adding this to project's gradle.properties
fixed it for us:
android.enableJetifier=true
android.useAndroidX=true
Changed all dependencies to compile rather than implementation, then I rebuild the project without errors. Then I switched back to implementation rather than leaving it as compile.
The solution for this is that remove this following dependency:
implementation 'com.android.support:design:26.1.0'
put general dependencies as:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-compat:26.1.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:support-v4:26.1.0'
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 'com.facebook.android:audience-network-sdk:4.99.1'
}
Your build script should match with application build.gradle dependencies.
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
dependencies {
.................
...................
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:design:27.1.0'
................
...........
}
if you want to downgrade dependencies then also downgrade supportLibVersion and buildToolsVersion .