我的 Android 项目在迁移到新系统后遇到了问题。该项目在以前版本的 Android Studio 中运行良好,但现在我在尝试构建时遇到以下错误:
Failed to resolve: com.ismaeldivita.chipnavigation:chip-navigation-bar:1.3.3
每个 JitPack.io 依赖项都会出现此问题。经过大量搜索后,我发现将以下行添加到存储库部分通常可以解决大多数用户的问题:
maven { url 'https://jitpack.io' }
但是,就我而言,我仍然遇到同样的错误。我不确定我做错了什么。 也在一些帖子中建议添加
maven { url = uri("https://www.jitpack.io" ) }
代替旧的,这也不起作用。
这是我的
settings.gradle
文件:
pluginManagement {
repositories {
gradlePluginPortal()
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "Sabir Khansaheb & Sons"
include ':app'
这是我的
build.gradle
:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.6.0' apply false
id 'com.android.library' version '8.6.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我的
buid.gradle(app)
:
plugins {
id 'com.android.application'
}
android {
buildFeatures {
buildConfig = true
}
compileSdk 34
defaultConfig {
applicationId "com.sabirkhansahebsons"
minSdk 26
targetSdk 34
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
}
namespace 'com.sabirkhansahebsons'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
implementation 'com.ismaeldivita.chipnavigation:chip-navigation-bar:1.3.3'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
}