我创建了一个空白的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库,但google库编译没有问题时,就会出现错误.请问我该怎么办?

这是我的身材.格拉德尔

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'
}

这是我的设置.格拉德尔

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库

推荐答案

com.miguelcatalan:materialsearchview has not been updated in five years.我强烈建议您使用正在积极维护的库.使用主动维护库的一个副作用是,它将位于您使用的一个工件存储库中.

如果您坚持使用此库,请更改:

repositories {
    maven {url 'https://jitpack.io'}
    google()
    mavenCentral()

}

致:

repositories {
    maven {url 'https://jitpack.io'}
    google()
    mavenCentral()
    jcenter()
}

Android相关问答推荐

编写视觉转型

广播接收者意图从服务内设置,而不被其他服务接收

Android配置设置. gradle不同应用风格

长流与长流的比较<>

如何go 除回调流中不可用的状态?

Android 14上的慢速意图广播交付

如何删除Jetpack Compose中的Textfield底线

strings.xml中字符串数组中的占位符

Jetpack编写错误(java.lang.NoSuchMethodError:无接口方法startRestartGroup)

更改活动(上下文)对接收到的uri的访问权限的影响?

Android Compose 为什么 Checkbox 在父对象可点击时需要 onCheckChanged?

状态更改后 colored颜色 未正确更改

从活动共享视图模型以使用 hilt 组合函数

如何使用 Jetpack Compose 制作两个圆圈

如何只允许拖动 BottomSheetScaffold 中 BottomContent 的 SheetPeek 的一部分?

viewModel 的可变值状态不起作用

处理程序 postDelayed 方法不起作用,kotlin 应用程序卡在启动画面上

在 Compose 中使用 DeepLink 会导致无法向后导航

react-native android项目未找到错误

在delphi中将Jnet_uri转换为Tbitmap