這是我的 Gradle
插件{
id 'com.android.application'
}
安卓 {
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
}
}
依賴{
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'
}
這個輸出:
在依賴項的 AAR 元資料 (META-INF/com/android/build/gradle/aar-metadata.properties) 中指定的 minCompileSdk (31) 大于此模塊的 compileSdkVersion (android-26)。依賴:androidx.appcompat:appcompat:1.4.2。
uj5u.com熱心網友回復:
compileSdkVersiontargetSdkVersion你必須讓它達到水平31
版本 28(適用于 Android Pie 及以下版本)是舊版支持庫的最后一個版本,因此我們建議您在使用 Android Q 并繼續前進時遷移到 AndroidX 庫。
老的:
implementation 'com.android.support:design:26.0.0'
新的:
implementation 'com.google.android.material:material:1.6.1'
您可以像這樣更新檔案:
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'
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/489548.html
上一篇:AndroidEmulator(版本12,androidstudioChipmunk)在除錯時隨機卡在“等待除錯器”
