Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Circular dependency between the following tasks in gradle

Tags:

android

I'm running my project in AndroidStudio 3.2, but there is an error

FAILURE: Build failed with an exception.

* What went wrong:
Circular dependency between the following tasks:
:app:checkManifestChangesDebug
\--- :app:instantRunMainApkResourcesDebug
     \--- :app:transformClassesAndDexWithShrinkResForDebug
          \--- :app:transformDexArchiveWithDexMergerForDebug
               +--- :app:preColdswapDebug
               |    \--- :app:incrementalDebugTasks
               |         +--- :app:transformClassesAndClassesEnhancedWithInstantReloadDexForDebug
               |         |    \--- :app:transformClassesWithInstantRunForDebug
               |         |         \--- :app:checkManifestChangesDebug (*)
               |         \--- :app:transformClassesWithInstantRunForDebug (*)
               \--- :app:transformClassesWithDexBuilderForDebug
                    +--- :app:preColdswapDebug (*)
                    \--- :app:transformClassesWithInstantRunForDebug (*)

(*) - details omitted (listed previously)

I can still generate APKs manually, but the "Run" button doesn't work.

How can I solve the issue?

like image 408
李老栓 Avatar asked Oct 12 '18 12:10

李老栓


People also ask

Why do I get a circular dependency error in Gradle?

In a multi project build with a deep structure where several projects have the same short name (in different paths), if project depends on another project, you get a circular dependency error. Note: this is not related to the Kotlin Gradle plugin, as it can be reproduced with pure Java as well. FAILURE: Build failed with an exception.

What is a project dependency in Gradle?

Dependencies between projects Gradle can model dependencies between modules. Those dependencies are called project dependencies because each module is represented by a Gradle project. Example 10.

How to remove a circular dependency from a module?

Removing a circular dependency cannot be resolved with build trickery. You're going to have to refactor your modules so there is no longer a circular dependency. From your module names, and with no other information, I would think you would want to extract the part of "common" that depends on "product-*" and put it into a new module.

What is Gradle configuration?

Gradle represents the scope of a dependency with the help of a Configuration . Every configuration can be identified by a unique name. Many Gradle plugins add pre-defined configurations to your project.


1 Answers

Disable instant run from settings

Settings > search for instant run > uncheck "Enable Instant Run to hot swap code/resource changes on display"

like image 186
Ibrahim Avatar answered Oct 05 '22 03:10

Ibrahim