Github 构建期间未找到包

Github package not found during build

我添加了一个我自己的 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