我創建了一個運行良好的空白 android 專案,但是當我嘗試使用在 github 上找到的這個庫時,我得到了這個錯誤。
failed org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.miguelcatalan:materialsearchview:1.4.0.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.miguelcatalan:materialsearchview:1.4.0.
當我使用任何 github 庫但谷歌庫編譯沒有問題時會發生錯誤。請問我該怎么辦?
這是我的 build.gradle
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.myapplication"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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 'com.google.android.material:material:1.4.0'
//implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-analytics:20.1.2'
implementation 'org.apache.commons:commons-text:1.6'
implementation 'com.github.ksoichiro:simplealertdialog:1.2.1@aar'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.7.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.3.0-alpha02'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.miguelcatalan:materialsearchview:1.4.0' //Here is github Library
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
這是我的 settings.gradle
pluginManagement {
repositories {
maven {url 'https://jitpack.io'}
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven {url 'https://jitpack.io'}
google()
mavenCentral()
}
}
rootProject.name = "My Application"
include ':app'
我不知道我做錯了什么。我真的被困住了我不能使用 github 庫
uj5u.com熱心網友回復:
com.miguelcatalan:materialsearchview五年沒更新了。我強烈建議您使用正在積極維護的庫。使用主動維護的庫的一個副作用是它將位于您使用的工件存盤庫之一中。
如果您堅持使用此庫,請更改:
repositories {
maven {url 'https://jitpack.io'}
google()
mavenCentral()
}
到:
repositories {
maven {url 'https://jitpack.io'}
google()
mavenCentral()
jcenter()
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/471536.html
下一篇:在Kotlin中定義一個按鈕
