weixin_42697546 2025-01-14 00:12 采纳率: 25%
浏览 410

构建apk时报错,jitpack.io 提示需要输入账号密码

仓库需要账号密码验证才能使用?
这是啥原因呢?
我没有包含这个 lib_common
只包含了
implementation 'com.github.Blankj:AndroidUtilCode:1.30.0'



```bash

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.github.Blankj:lib_common:1.30.0.
     Required by:
         project :app > com.github.Blankj:AndroidUtilCode:1.30.0 > com.github.Blankj.AndroidUtilCode:utilcode-export:1.30.0
      > Could not resolve com.github.Blankj:lib_common:1.30.0.
         > Could not get resource 'https://jitpack.io/com/github/Blankj/lib_common/1.30.0/lib_common-1.30.0.pom'.
            > Could not GET 'https://jitpack.io/com/github/Blankj/lib_common/1.30.0/lib_common-1.30.0.pom'. Received status code 401 from server: Unauthorized
      > Could not resolve com.github.Blankj:lib_common:1.30.0.
         > Could not get resource 'https://www.jitpack.io/com/github/Blankj/lib_common/1.30.0/lib_common-1.30.0.pom'.
            > Could not GET 'https://www.jitpack.io/com/github/Blankj/lib_common/1.30.0/lib_common-1.30.0.pom'. Received status code 401 from server: Unauthorized



```

  • 写回答

2条回答 默认 最新

  • 道友老李 JWE233286一种基于机器视觉的水表指针读数识别及修正的方法 专利发明者 2025-01-14 00:13
    关注
    让【道友老李】来帮你解答,本回答参考gpt编写,并整理提供,如果还有疑问可以点击头像关注私信或评论。
    如果答案让您满意,请采纳、关注,非常感谢!
    问题:仓库需要账号密码验证才能使用? 回答:是的,根据错误信息中显示的内容,仓库需要账号密码验证才能使用。具体原因是因为您包含了一个名为`com.github.Blankj:AndroidUtilCode:1.30.0`的库,而该库依赖了一个名为`com.github.Blankj:lib_common:1.30.0`的子模块。在尝试解析`com.github.Blankj:lib_common:1.30.0`时,需要访问远程仓库进行下载,但由于没有提供正确的账号密码验证,导致无法下载成功,从而出现了`Received status code 401 from server: Unauthorized`的错误。 案例:当使用Gradle构建项目时,如果依赖的库需要从私有仓库下载,并且该私有仓库需要账号密码验证,就会出现类似的错误信息。 解决方法:在这种情况下,需要提供正确的账号密码验证信息才能下载库的依赖。可以在项目中的`build.gradle`文件中配置对应的凭据信息,示例代码如下:
    repositories {
        maven {
            url 'https://www.jitpack.io'
            credentials {
                username 'your_username'
                password 'your_password'
            }
        }
    }
    

    通过在repositories部分添加credentials字段,并填入正确的用户名和密码,就可以解决账号密码验证的问题,从而成功下载所需的库依赖。

    评论

报告相同问题?

问题事件

  • 创建了问题 1月14日