未能在 gradle 中添加依赖项
Failed to add dependencies in gradle
我正在学习在 Java 中构建 android 应用程序,我想在我的 android 项目中实现 tinder 刷卡。我在 https://github.com/yuyakaido/CardStackView 找到了 CardStackView,我想使用它。但是我无法在 build.gradle 中添加依赖项。这是我的 build.gradle 文件:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.appname"
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
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.annotation:annotation:1.3.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'com.google.android.material:material:1.6.0-alpha03'
implementation 'com.google.android.gms:play-services-base:18.0.1'
implementation 'com.github.Cutta:GifView:1.4'
implementation 'com.google.firebase:firebase-database:20.0.4'
implementation 'com.google.firebase:firebase-auth:21.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.4.1'
implementation 'androidx.navigation:navigation-ui:2.4.1'
implementation 'com.yuyakaido.android:card-stack-view:2.3.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
这是我经常收到的错误消息:
Could not find com.yuyakaido.android:card-stack-view:2.3.4.
Required by:
project :app
我试过使用双引号、清理和重建项目,以及重新启动我的 android 工作室。但是我无法解决这个问题。我错过了什么吗?提前致谢。
这个库使用 JCenter。但是 JCenter 已被弃用,因此它不会出现在您的 gradle.build 中。请将 JCenter 添加到您的 gradle.build.
或者使用 JitPack 仓库。参考 here
我正在学习在 Java 中构建 android 应用程序,我想在我的 android 项目中实现 tinder 刷卡。我在 https://github.com/yuyakaido/CardStackView 找到了 CardStackView,我想使用它。但是我无法在 build.gradle 中添加依赖项。这是我的 build.gradle 文件:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.appname"
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
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.annotation:annotation:1.3.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'com.google.android.material:material:1.6.0-alpha03'
implementation 'com.google.android.gms:play-services-base:18.0.1'
implementation 'com.github.Cutta:GifView:1.4'
implementation 'com.google.firebase:firebase-database:20.0.4'
implementation 'com.google.firebase:firebase-auth:21.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.4.1'
implementation 'androidx.navigation:navigation-ui:2.4.1'
implementation 'com.yuyakaido.android:card-stack-view:2.3.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
这是我经常收到的错误消息:
Could not find com.yuyakaido.android:card-stack-view:2.3.4.
Required by:
project :app
我试过使用双引号、清理和重建项目,以及重新启动我的 android 工作室。但是我无法解决这个问题。我错过了什么吗?提前致谢。
这个库使用 JCenter。但是 JCenter 已被弃用,因此它不会出现在您的 gradle.build 中。请将 JCenter 添加到您的 gradle.build.
或者使用 JitPack 仓库。参考 here