我嘗試在 Gradle 檔案中將我的 AppCompat 庫從 1.0.0 更新到 1.5.1,但出現此錯誤
Could not resolve androidx.appcompat:appcompat:1.5.1.
Required by:
project :app
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
我嘗試更新庫,但總是出錯。
這是我的 Gradle 檔案的內容
buildscript {
ext {
kotlin_version = '1.7.10'
}
repositories {
jcenter()
google()
//maven { url 'https://maven.fabric.io/public' }
//maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
我該如何解決這個錯誤?
uj5u.com熱心網友回復:
我不知道為什么,但我嘗試使用下面的代碼
implementation group: 'com.google.android.material', name: 'material', version: '1.6.1'
代替
implementation 'com.google.android.material:material:1.0.0'
現在對我來說可以毫無問題地匯入最后一個應用程式兼容庫
implementation 'androidx.appcompat:appcompat:1.5.1'
現在我能夠毫無問題地匯入庫
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/521320.html
標籤:毕业典礼