1

我在服务器上安装了 JFrog Open Source 并手动上传了一个 android aar 库。在 gradle 文件中,我设置了这样的配置。

buildscript {
    
        dependencies { classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release" }
    
        repositories {
            maven {
                credentials {
                    username = artifactory_username
                    password = artifactory_password
                }
                url "https://.../artifactory/libs-release"
            }
        }
    }
    
    allprojects{
            apply plugin: org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin
            artifactory {
                resolve {
                    contextUrl = "https://.../artifactory"
                    repoKey = 'libs-global'
                    username = artifactory_username
                    password = artifactory_password
                }
            }
        }
        
    buildscript {
       repositories {
            jcenter()
       }
    
    dependencies {
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
        }
       }
    apply plugin: "com.jfrog.artifactory"

问题: 如何在 android 项目中下载或实现我的 aar 库?

例子:

implementation 'com.google.code.gson:gson:2.8.6'
4

1 回答 1

0

您需要在 build.gradle(project) 中添加您的 Jfrog,如下所示:

allprojects {
    repositories {
        ...
        maven {
            url("https://your-url.jfrog.com/more/path")
        }

        google()
        jcenter()
        ...
    }
}

然后你只需在依赖项中添加你的依赖项。

于 2021-08-05T14:41:47.470 回答