Gradle – How to open folder with generated APK?

android {
    applicationVariants.all { variant ->
        variant.outputs.all {
            def flavor = variant.productFlavors[0].name
            if (flavor == 'prod') { // Open folder for specific flavor
                variant.assemble.finalizedBy openFolderWithApk
            }
        }
    }

    task openFolderWithApk(type:Exec) {
        workingDir '../app/prod/release/' //Update flavor and buildType
        commandLine 'cmd', '/c', 'start .' //on windows
    }
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.