简体   繁体   中英

I got this error when I tried to run my app in android studio. Does anyone know how to solve this problem?

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)

Here is my build.gradle

buildTypes {
    debug {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       debuggable true
    }
    customDebuggableBuildType {
        debuggable true
    }
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        debuggable false
        signingConfig signingConfigs.config
    }
}

I tried to change from debuggable true to false then it works but cannot do a debugging Thx in advance

This is a common error that is shown when you add 2 views inside a RelativeLayout while the first one depends on the second one and the second one depends on the first one. For example, when you put the first view toRightOf="@+id/secondView" secondView and the second view toRightOf="@+id/firstView" first view, then this will cause this error.

Your below two gradle tasks depends on each other.

:app:checkManifestChangesDebug 
:app:transformClassesWithInstantRunForDebug

But, this is NOT allowed in Gradle build system. You should remove this circular dependency.

One simpler solution is to disable your instant run feature, see: https://developer.android.com/studio/run/#disable-ir

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM