Issue
this my Gradle
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 26
buildToolsVersion '29.0.2'
defaultConfig {
applicationId "com.example.tablayout"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner defaultTestInstrumentationRunner
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.android.support:design:26.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
testImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
this output:
The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-26). Dependency: androidx.appcompat:appcompat:1.4.2.
Solution
compileSdkVersion
and targetSdkVersion
You have to get it to level 31
Version 28 (intended for Android Pie and below) is the last version of the legacy support library, so we recommend that you migrate to AndroidX libraries when using Android Q and moving forward.
Old:
implementation 'com.android.support:design:26.0.0'
New:
implementation 'com.google.android.material:material:1.6.1'
You can update the file like this:
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.example.tablayout"
minSdkVersion 19
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner defaultTestInstrumentationRunner
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
testImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Answered By - Halil Ozel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.