How to set name of AAR output from Gradle

后端 未结 7 454
一整个雨季
一整个雨季 2021-01-30 10:18

I have a project with several modules in it one of which is a Android Library named (poorly) as sdk. When I build the project it outputs an AAR named sdk.aar<

7条回答
  •  一个人的身影
    2021-01-30 10:54

    In addition to qix answer here the info that you can add multiple output paths by this method by an regular string as well:

    libraryVariants.all { variant ->
            variant.outputs.each { output ->
                def outputFile = output.outputFile
                if (outputFile != null && outputFile.name.endsWith('.aar')) {
                    def fileName = "${archivesBaseName}-${version}.aar"
                    output.outputFile = new File(outputFile.parent, fileName)
                    output.outputFile = new File("/home/pepperonas/IdeaProjects/Libraries/Base/testapp/libs", fileName)
                }
            }
        }
    

    (Upvotes belong to qix - I just wrote this as an answer because of the readability).

提交回复
热议问题