Zachary Sweigart
Zachary Sweigart

Reputation: 1111

Gradle Profile Shows Dependency Resolution for Other Variants

I have a multi-module build that has multiple variants, for example modules App, LibA and LibB and variants release, debug, and tester. When I run a build profile for the tester variant, I see under dependency resolution that the following are running:

App:releaseCompileClasspath
App:releaseRuntimeClasspath
App:releaseImplementationDependenciesMetadata
App:releaseRuntimeOnlyDependenciesMetadata
App:releaseAnnotationProcessorClasspath
App:releaseApiDependenciesMetadata
App:releaseCompileOnly
App:releaseCompileOnlyDependenciesMetadata

These extra tasks are slowing down my build, is there any reason they are running or any way to disable them?

Upvotes: 0

Views: 236

Answers (1)

Sneh Pandya
Sneh Pandya

Reputation: 8483

Voila! This exact scenario has been targeted in Android Studio 3.3!

Android Studio 3.3 now supports Single-variant project sync!

As per the latest release notes for Android Studio 3.3,

Syncing your project with your build configuration is an important step in letting Android Studio understand how your project is structured. However, this process can be time-consuming for large projects. If your project uses multiple build variants, you can now optimize project syncs by limiting them to only the variant you have currently selected.

Requirements:

  1. Android Studio 3.3 or higher
  2. Android Gradle plugin 3.3.0 or higher

Steps:

Click File > Settings > Experimental > Gradle (Android Studio > Preferences > Experimental > Gradle on a Mac) and select the Only sync the active variant checkbox

Upvotes: 1

Related Questions