我正在使用这个库中的photoview:
我已经按照此URL上Gradle Dependency中的Maven代码进行了添加:https://github.com/chrisbanes/PhotoView
com.github.chrisbanes:PhotoView:1.3.1
,但我的Gradle无法同步。
![error](https://istack.dev59.com/CRVKB.webp)
![gradle file](https://istack.dev59.com/ghEoD.webp)
com.github.chrisbanes:PhotoView:1.3.1
,但我的Gradle无法同步。
我遇到了这个问题,并通过在buildscript中添加仓库来解决它。这里是我的 build.gradle 文件(不是模块文件,而是项目文件):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我不知道为什么需要这样做,因为我的一个朋友只是在 allprojects 块中添加了该存储库,它对他有效。
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url "https://jitpack.io" }
}
}
maven { url "https://www.jitpack.io" }
implementation'com.github.chrisbanes:PhotoView:latest.release.here'
在 build.gradle 中。
2.0.0
[截至2017年3月18日
](而不是1.3.1
),请查看发布页面。build.gradle
中使用此代码:implementation 'com.github.chrisbanes:PhotoView:2.0.0'
测试通过(这里是 gradle/jitpack
找到的):
Download https://jitpack.io/com/github/chrisbanes/PhotoView/2.0.0/PhotoView-2.0.0.pom
Download https://jitpack.io/com/github/chrisbanes/PhotoView/2.0.0/PhotoView-2.0.0.aar
https://bintray.com/bintray/jcenter/com.github.chrisbanes.photoview:library#statistics
这是我的答案,经过多次尝试解决了!
在你的 build.gradle 文件中,应该有最后两行。
allprojects {
repositories {
google()
jcenter()
// for photo view
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}
然后添加最新版本。
// photo view
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
这应该可以运行,希望能帮到你。
在settings.gradle中添加:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven { url "https://jitpack.io" }
}
}
maven { url "https://jitpack.io" }
? - ρяσѕρєя K