Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Debug and Release artifcats #11

Closed
ikabar opened this issue Feb 24, 2015 · 2 comments
Closed

Debug and Release artifcats #11

ikabar opened this issue Feb 24, 2015 · 2 comments

Comments

@ikabar
Copy link

ikabar commented Feb 24, 2015

Hi all,

I'm new to this great project.
I have a multi module project (APK and AAR module) which I want to install in my local repository (and I successfully did)

But I also noticed that the install task does not take the "Debug" and "Release" artifacts.

Am I missing something ?

Also I'm a little new to Gradle and was wondering what execution command you are using in your build.

I executed 'gradle clean assemble install' which did both assemble and install my .m2 contains only a project.apk and not projectDebug.apk (same goes for AAR)

Please advise.
Thanks, Ika.

@dcendents
Copy link
Owner

Hi,

I normally run 'gradlew clean build install'

If you want to install all the variants (build types + flavors), then you have to configure the android plugin to do it. Something like:

android {
    compileSdkVersion 21
    buildToolsVersion = rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion 8
    }

    productFlavors {
        Flavor1
        Flavor2
    }
    defaultPublishConfig "Flavor1Release"
    publishNonDefault true
}

However for library projects when you do that the pom is not generated, as if having only artifacts with a classifier breaks the maven pom generation. So I add this to my scripts to publish the "defaultPublishConfig" as the main aar and then the pom gets generated correctly:

if( android.productFlavors.size() > 0 ) {
    android.libraryVariants.all { variant ->
        // Publish a main artifact, otherwise the maven pom is not generated
        if( android.publishNonDefault && variant.name == android.defaultPublishConfig ) {
            def bundleTask = tasks["bundle${name.capitalize()}"]
            artifacts {
                archives(bundleTask.archivePath) {
                    classifier null
                    builtBy bundleTask
                }
            }
        }
    }
}

Hope this helps

@ikabar
Copy link
Author

ikabar commented Feb 25, 2015

Hi,

Your comment was extremely useful and now all my artifacts are placed in the .m2

It's great to see such a quick support in this project.

Thank you. Ika.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants