有些图书馆无法使用。
Android-Image-Slider 和其他一些库在构建时未实现。我已经更新了规范和版本,所以它和代码没有问题。
这是片段
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
maven { url "https://jitpack.io" }
maven { url 'https://jitpack.io' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
这是我在构建过程中得到的:
无法获取“https://jitpack.io/com/github/smarteist/autoimageslider/1.4.0/autoimageslider-1.4.0.pom”。从服务器收到状态代码 401:未经授权
这是带有相关错误的部分构建输出:
9: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.github.smarteist:autoimageslider:1.4.0.
Required by:
project :app
> Could not resolve com.github.smarteist:autoimageslider:1.4.0.
> Could not get resource 'https://jitpack.io/com/github/smarteist/autoimageslider/1.4.0/autoimageslider-1.4.0.pom'.
> Could not GET 'https://jitpack.io/com/github/smarteist/autoimageslider/1.4.0/autoimageslider-1.4.0.pom'. Received status code 401 from server: Unauthorized
> Could not find com.google.android.exoplayer:exoplayer:r1.5.6.
Required by:
project :app
> Could not find com.google.android.exoplayer:exoplayer-core:2.7.3.
Required by:
project :app
> Could not find com.google.android.exoplayer:exoplayer-dash:2.7.3.
Required by:
project :app
> Could not find com.google.android.exoplayer:exoplayer-hls:2.7.3.
Required by:
project :app
> Could not find com.google.android.exoplayer:exoplayer-smoothstreaming:2.7.3.
Required by:
project :app
> Could not find com.google.android.exoplayer:exoplayer-ui:2.7.3.
Required by:
project :app
您的问题是,如果旧工件名称与在 JCenter 上发布的一样,您仍在使用部件,但 Jitpack 基于 URL。
查看您似乎用作依赖项的 Gradle 错误消息
com.github.smarteist.autoimageslider:1.4.0
(以及您的问题中缺少的重要细节)。
但是 GitHub 项目的 URL 为
https://github.com/smarteist/Android-Image-Slider
,这意味着最后一部分应该是 Android-Image-Slider
而不是 autoimageslider
。