Android Studio - 实现材料日历视图无法解析。旧版本可以工作

问题描述 投票:0回答:2

有人可以帮忙解决这个问题吗?不知道为什么它不解析为 2.0.1 但它解析为 1.4.3

无法解决:com.github.prolificinteractive:material-calendarview:2.0.1 受影响的模块:app

build.grade(项目)文件有:

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

build.gradle(模块)文件有:

dependencies {
  implementation 'com.github.prolificinteractive:material-calendarview:2.0.1' <-"correct" per docs
  // implementation 'com.prolificinteractive:material-calendarview:1.4.3' <-- works
  // implementation 'com.prolificinteractive:material-calendarview:2.0.1' <-- does not work
  // implementation 'com.github.prolificinteractive:material-calendarview:2.0.1' <-- does not work
  // implementation 'com.github.prolificinteractive:material-calendarview:1.4.3' <-- does not work
  implementation 'androidx.core:core-ktx:1.7.0'
  implementation 'androidx.appcompat:appcompat:1.4.1'
  implementation 'com.google.android.material:material:1.5.0'
  implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
  testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    }

还尝试通过项目结构添加,但如果我搜索它,它找不到 com.github.prolificinteractive:material-calendarview 但如果我搜索material-calendarview,我可以找到 1.4.3

谢谢

项目结构1

项目结构2

android gradle
2个回答
3
投票

如果这是一个新项目,可能你有settings.gradle,那么你应该将其添加到那里:

dependencyResolutionManagement {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

您可以随时从 settings.gradle 中删除此代码块并按照 github 存储库中的建议使用它。确保将

maven { url 'https://jitpack.io' }
添加到
allprojects
内部,而不仅仅是
repositories
块。像这样:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

0
投票

repo现已移至此处,您可以在build.gradle中添加(项目级别):

maven {
            url "https://maven.scijava.org/content/repositories/public/"
      }

这是我的全部代码:

buildscript {
    repositories {
        google()
        maven {
            url "https://jcenter.bintray.com/"
        }
        maven {
            url "https://maven.scijava.org/content/repositories/public/"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
    }
}

allprojects {
    repositories {
        google()
        maven { url "https://jitpack.io" }
        mavenCentral()
        maven { url 'https://maven.google.com' }
        maven {
            url "https://jcenter.bintray.com/"
        }
        maven {
            url "https://maven.scijava.org/content/repositories/public/"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
© www.soinside.com 2019 - 2024. All rights reserved.