jily
jily

Reputation: 344

Output .aar file to different app project libs directory

libraryVariants.all { variant ->
    variant.outputs.each { output ->
        def outputFile = output.outputFile
        if (outputFile != null && outputFile.name.endsWith('.aar')) {
            //def fileName = "apc-${defaultConfig.versionCode}.aar"
            def fileName ="apc.aar"
           // output.outputFile = new File(outputFile.parent, fileName)
           output.outputFile = new File('../../App/app/libs/',fileName)
        }
    }
}

This error comes
Cannot expand ZIP '/home/raminder/Code/App/app/libs/apc.aar' as it does not exist.

Upvotes: 0

Views: 289

Answers (1)

Owais Ali
Owais Ali

Reputation: 724

It will likely be much cleaner and less error prone to do this as a separate Gradle Copy task. You can also add a dependency such that this task gets run after every build so you don't need to run the task manually.

Upvotes: 1

Related Questions