我添加了一个我自己的 Github 包作为我的 Android Studio 项目的依赖项。当我执行 Gradle 同步时,一切似乎都很好,没有错误。但是,下次我运行“重建项目”时,出现以下错误:
Could not determine the dependencies of task ':app:processReleaseResources'.
Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
Could not find <my_config_properties_reader_package>:1.0.7.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/<my_config_properties_reader>/1.0.7/config_properties_reader_android-1.0.7.pom
- https://jcenter.bintray.com/<my_config_properties_reader>/1.0.7/config_properties_reader_android-1.0.7.pom
Required by:
project :app > project :identity_provider_access
包中的类和接口(interface)可以毫无问题地导入,但我无法成功运行构建。有谁知道这是什么?
最佳答案
我有同样的问题。
我创建了一个带有应用程序和模块的项目,该项目使用了另一个 github 包。
在构建应用程序时,我遇到了同样的错误。
最后我的项目结构如下
project
app
module_project
module_dependency
对我来说,它有助于将依赖模块 (module_dependency) 的 github 存储库添加到我的应用程序的 gradle 中。用户凭据是从位于项目正下方的文件“github.properties”中检索的。def githubProperties = new Properties()
githubProperties.load(new FileInputStream(rootProject.file("github.properties")))
repositories {
maven {
name = "GitHubPackages"
url = uri("uri_module_dependency")
credentials {
username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER")
password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY")
}
}
}
该文件如下所示:gpr.usr=your github account user name
gpr.key=your created github personal access token
关于android - 构建期间找不到 Github 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64100154/