【问题标题】:Adding external dependecy to AAR file将外部依赖项添加到 AAR 文件
【发布时间】:2022-02-21 17:53:49
【问题描述】:

我正在尝试将 groundsdk 依赖项添加到我在 android studio 中的 .aar 模块中。 到目前为止,我关注了this thread 并设法获取了我的 pom 文件,但我的 .aar 文件中看不到任何变化。

谁能澄清这条线的去向?

implementation '${YOUR_GROUP_ID}:${YOUR_ARTIFACT_ID}:${YOUR_VERSION}'

另外,我如何知道我的 .aar 是否包含我的依赖项?

我的库/build.gradle


dependencies {
    compileOnly files('libs/classes.jar')

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    // GroundSdk dependencies
    implementation 'com.parrot.drone.groundsdk:groundsdk:7.0.1'
    runtimeOnly 'com.parrot.drone.groundsdk:arsdkengine:7.0.1'

    //implementation 'com.test:anafi:1.0'
}
project.afterEvaluate {
    publishing {
        publications {
            library(MavenPublication) {
                groupId = 'com.test'
                //You can either define these here or get them from project conf elsewhere
                artifactId = 'anafi'
                version = 1.0
                artifact bundleReleaseAar //aar artifact you want to publish

                pom.withXml {
                    def dependenciesNode = asNode().appendNode('dependencies')
                    configurations.implementation.allDependencies.each {
                        def dependencyNode = dependenciesNode.appendNode('dependency')
                        dependencyNode.appendNode('groupId', it.group)
                        dependencyNode.appendNode('artifactId', it.name)
                        dependencyNode.appendNode('version', it.version)
                    }
                }
            }
        }
    }
}

谢谢大家

【问题讨论】:

    标签: android-studio module dependencies pom.xml aar


    【解决方案1】:

    好的,所以这对我来说不是解决问题的方法。

    我最终尝试了其他方法并找到了答案。

    我在this thread发布了我的解决方案

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-16
      • 1970-01-01
      • 2016-11-22
      • 2021-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多