So I installed android studio 3.0.1 and as soon as it opened the gradle built and showed the following errors. I tried adding dependencies such as design and support but in
This error occurs because of mismatched compileSdkVersion
and
library version.
for example:
compileSdkVersion 27
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
and also avoid to use + sign with library as in the following:
implementation 'com.android.support:appcompat-v7:26.+'
use exact library version like this
implementation 'com.android.support:appcompat-v7:26.1.0'
Using + sign with the library makes it difficult for the building process to gather the exact version that is required, making system unstable, hence should be discouraged.
Maybe it's too late but i found a solution:
You have to edit in the build.gradle
either the compileSdkVersion
--> to lastest (now it is 28). Like that:
android {
compileSdkVersion 28
defaultConfig {
applicationId "NAME_OF_YOUR_PROJECT_DIRECTORY"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
or you can change the version of implementation:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'com.android.support:design:27.+'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
}
If you are migrated for AndroidX and getting this error, you need to set the compile SDK to Android 9.0 (API level 28) or higher
This Is Because compileSdkVersion , buildToolsVersion and Dependecies implementations are not match You Have to done like this i have 28 library then
compileSdkVersion 28
targetSdkVersion 28
buildToolsVersion 28.0.3
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
If we You Use Any where less than 28 this error should occured so please try match library in all.
Found a neat plugin to solve this: cordova-android-support-gradle-release
cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.+ --save
In my case, this error ocurred while i was using the
implementation 'com.android.support:appcompat-v7:+'
implementation 'com.android.support:design:+'
libraries together with googles
implementation 'com.google.android.material:material-components:+'
library. If this is the case in your project, i highly recommend to fully remove the google material components library from your project.