android - 构建期间找不到 Github 包
问题描述
我添加了一个我自己的 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
包中的类和接口可以毫无问题地导入,但我无法成功运行构建。有谁知道这是什么?
解决方案
我有同样的问题。我创建了一个带有应用程序和模块的项目,该项目使用了另一个 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
推荐阅读
- typescript - 尝试使用接口进行分配
- visual-studio-code - 我应该在哪里保存扩展数据以便我在更新扩展时可以检索这些数据?
- javascript - jQuery图形,根据输入的图表自定义不起作用
- angular - 如何在角度材料的数据源中设置值
- bash - 如何在 BASH 上运行一个使用 GNU 并行接受多个参数的 python 脚本?
- grammar - 如何设计避免重复的上下文无关语法?
- reactjs - 在 React 中关闭模式后将焦点发送到下拉列表
- r - 计算并汇总 ID 和购买日期,同时创建反映每天购买量和客户的第三列
- android - 它说“尝试加载库”然后应用程序退出而没有任何信息
- macos - 如何在使用 Chrome 和 macOS 的全屏模式下输入新的