Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Circular dependency between the following tasks

Tags:

I try to solve this problem for more than 5 hours. What could be the problem?

Circular dependency between the following tasks: :app:checkManifestChangesDevelopDebug \--- :app:instantRunMainApkResourcesDevelopDebug      \--- :app:transformClassesAndDexWithShrinkResForDevelopDebug           \--- :app:transformDexArchiveWithDexMergerForDevelopDebug                +--- :app:preColdswapDevelopDebug                |    \--- :app:incrementalDevelopDebugTasks                |         +--- :app:transformClassesAndClassesEnhancedWithInstantReloadDexForDevelopDebug                |         |    \--- :app:transformClassesWithInstantRunForDevelopDebug                |         |         \--- :app:checkManifestChangesDevelopDebug (*)                |         \--- :app:transformClassesWithInstantRunForDevelopDebug (*)                \--- :app:transformClassesWithDexBuilderForDevelopDebug                     +--- :app:preColdswapDevelopDebug (*)                     \--- :app:transformClassesWithInstantRunForDevelopDebug (*)  (*) - details omitted (listed previously) 

I added:

org.gradle.configureondemand=true

But the problem is still present

build.gradle (Module: app)

buildscript {     repositories {         maven { url 'https://maven.fabric.io/public' }     }      dependencies {         classpath 'io.fabric.tools:gradle:1+'     } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'realm-android'   repositories {     maven { url 'https://maven.fabric.io/public' } }  static def getFullDate() {     return new Date().format('dd.MM.yyyy-HH.mm') }  static def getDate() {     return new Date().format('dd.MM.yyyy') }  android {     compileSdkVersion rootProject.ext.compileSdkVersion     buildToolsVersion '28.0.2'      defaultConfig {         applicationId "com.MYPROJECT"         minSdkVersion rootProject.ext.minSdkVersion         targetSdkVersion rootProject.ext.targetSdkVersion         versionCode 47         versionName "2.11d" //      project.ext.set("archivesBaseName", "MYPROJECT_" + versionName + "_" + getFullDate())         project.ext.set("archivesBaseName", "MYPROJECT_" + versionName + "_" + getDate())         vectorDrawables.useSupportLibrary = true         multiDexEnabled true          externalNativeBuild {             cmake {                 cppFlags "-std=c++11"             }         }     }      buildTypes {         debug {             minifyEnabled true             useProguard true             shrinkResources true             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     }      externalNativeBuild {         cmake {             path "CMakeLists.txt"         }     }      compileOptions {         sourceCompatibility JavaVersion.VERSION_1_8         targetCompatibility JavaVersion.VERSION_1_8     }      flavorDimensions "app"      productFlavors {          prod {             buildConfigField 'String', 'SERVER_BASE_URL', '"http://MYPROJECT.com/"'             dimension "app"         }          develop {             buildConfigField 'String', 'SERVER_BASE_URL', '"http://MYPROJECT.com/"'             buildConfigField 'String', 'YOUTUBE_API_KEY', '"AIzaSyD5eJIAcqUtMkBoorw_K8mh1d_TQSgjRwMT"'             applicationIdSuffix = ".dev"             versionNameSuffix = "-dev"             dimension "app"         }      }     dexOptions {     } }   dependencies {     implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"     annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"     implementation fileTree(include: ['*.jar'], dir: 'libs')     implementation('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {         transitive = true     }      //Google Supports     implementation "com.android.support:design:$rootProject.supportLibraryVersion"     implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"     implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"     implementation "com.android.support:preference-v7:$rootProject.supportLibraryVersion"      //Network     implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"     implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"     implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitVersion"     implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okhttpVersion"      //Constraint layout     implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLayoutVersion"      //Google services     implementation "com.google.android.gms:play-services-maps:$rootProject.googleServiceVersion"     implementation "com.google.android.gms:play-services-location:$rootProject.googleServiceVersion"     implementation "com.google.android.gms:play-services-gcm:$rootProject.googleServiceVersion"      //RxJava     implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjavaVersion"     implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxandroidVersion"      //Lifecycle     implementation "android.arch.lifecycle:runtime:$project.lifecycleVersion"     implementation "android.arch.lifecycle:extensions:$project.lifecycleVersion"     implementation "android.arch.lifecycle:viewmodel:$project.lifecycleVersion"     annotationProcessor "android.arch.lifecycle:compiler:$project.lifecycleVersion"      //Dagger dependencies     implementation "com.google.dagger:dagger:$rootProject.daggerVersion"     implementation "com.google.dagger:dagger-android:$rootProject.daggerVersion"     implementation "com.google.dagger:dagger-android-support:$rootProject.daggerVersion"     annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"     annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.daggerVersion"      //RxPermissions     implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar'      //RxBinding     implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'      //TIMBER      //implementation 'com.jakewharton.timber:timber:4.7.0'     testImplementation "junit:junit:$rootProject.junitVersion"      //Glide     implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion"     annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.glideVersion"     implementation files('src/main/jniLibs/aacdecoder-android-0.8.jar')      //Youtube     implementation files('libs/YouTubeAndroidPlayerApi.jar')      //Vitamio video player      //implementation project(':vitamio')      //VideoPlayer     implementation 'cn.jzvd:jiaozivideoplayer:6.2.12'     implementation 'org.greenrobot:eventbus:3.1.1'     implementation 'com.github.splatte:ViewPagerIndicator:3.0.0'     implementation 'com.h6ah4i.android.tablayouthelper:tablayouthelper:0.7.0'      //Rate App     implementation 'com.github.hotchemi:android-rate:1.0.1'     implementation 'de.hdodenhof:circleimageview:2.2.0'     implementation 'com.github.vbartacek:aacdecoder-android:0.8'     implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.11'     implementation 'com.github.arimorty:floatingsearchview:2.1.1'     implementation 'jp.wasabeef:glide-transformations:3.2.0'     implementation 'org.adw.library:discrete-seekbar:1.0.1'     implementation 'com.android.support:multidex:1.0.3'      //RouteController     implementation 'com.ncapdevi:frag-nav:3.0.0-RC3'      //Joda Time     implementation 'net.danlew:android.joda:2.9.9.4'      //ReactLocation     implementation 'pl.charmas.android:android-reactive-location2:2.1@aar'      //SeekBar     implementation 'com.xw.repo:bubbleseekbar:3.16-lite'      //Lombok      //Warning! Versions above 1.16.20 do not work with lambda (throws an exception when compiling)     compileOnly "org.projectlombok:lombok:$rootProject.lombokVersion"     annotationProcessor "org.projectlombok:lombok:$rootProject.lombokVersion"      //nv-websocket-client     implementation "com.neovisionaries:nv-websocket-client:$rootProject.nvWebSocketClientVersion"      //Custom tabs     implementation "com.android.support:customtabs:$rootProject.supportLibraryVersion"      //Auto scroll view pager for Suggestion     implementation("cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:$rootProject.autoScrollViewPagerVersion") {         exclude module: 'support-v4'     }      //Paging library     implementation "android.arch.paging:runtime:$rootProject.pagingLibraryVersion"      //Beacon Library     implementation 'org.altbeacon:android-beacon-library:2.15' } 

and build.gradle (Project: myproject)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript { repositories {     maven { url "http://dl.bintray.com/populov/maven" }     mavenCentral()     jcenter()     google()      maven {         url 'https://maven.google.com/'         name 'Google'     }     maven { url "https://jitpack.io" } } dependencies {     classpath 'com.android.tools.build:gradle:3.2.0'     classpath "io.realm:realm-gradle-plugin:5.1.0"     classpath 'me.tatarka:gradle-retrolambda:3.7.0'     // NOTE: Do not place your application dependencies here; they belong     // in the individual module build.gradle files } }  allprojects { repositories {     maven {         url 'https://maven.google.com/'         name 'Google'     }     maven { url  "http://dl.bintray.com/populov/maven" }     mavenCentral()     jcenter()      maven { url "https://jitpack.io" } } subprojects {     project.configurations.all {         resolutionStrategy.eachDependency { details ->             if (details.requested.group == 'com.android.support'                     && !details.requested.name.contains('multidex') ) {                 details.useVersion "27.1.1"             }         }     } } }  task clean(type: Delete) { delete rootProject.buildDir }  // Define versions in a single place ext { // Sdk and tools minSdkVersion = 19 targetSdkVersion = 27 compileSdkVersion = 27 buildToolsVersion = '27.0.3'  // App dependencies supportLibraryVersion = '28.0.0' butterKnifeVersion = '8.8.1' retrofitVersion = '2.3.0' okhttpVersion = '3.8.0' junitVersion = '4.12' glideVersion = '4.7.1' googleServiceVersion = '15.0.1' permissionDispatcherVersion = '3.1.0' rxjavaVersion = '2.1.12' rxandroidVersion = '2.0.2' lifecycleVersion = '1.1.1' daggerVersion = '2.16' pagingLibraryVersion = '1.0.1' autoScrollViewPagerVersion = '1.1.2' nvWebSocketClientVersion = '2.5' lombokVersion = '1.16.20' constraintLayoutVersion = '1.1.3' } 
like image 639
Артем Протасов Avatar asked Sep 27 '18 19:09

Артем Протасов


People also ask

What is meant by circular dependency?

A circular dependency occurs when two classes depend on each other. For example, class A needs class B, and class B also needs class A. Circular dependencies can arise in Nest between modules and between providers.

Can occur when there is a circular dependency between task and resources?

What is a circular dependency? Resource A is dependent on Resource B, and Resource B is dependent on Resource A. When AWS CloudFormation assesses that this type of condition exists, you will get a circular dependency error because AWS CloudFormation is unable to clearly determine which resource should be created first.

What is circular dependency error and how do you handle it?

A circular dependency is detected whenever two objects reference each other, in such a way that Power BI cannot process the objects. The details of why this happens are outlined in this article: Understanding Circular Dependencies in Tabular and PowerPivot – SQLBI.


2 Answers

This can occur when a module depends on itself!

For example, suppose this for module app:

...  dependencies {     compile project(':app') // !!!     ... } 
like image 86
Mir-Ismaili Avatar answered Oct 04 '22 13:10

Mir-Ismaili


But minifyEnabled is important in production. I have tried the following arrangement and it worked with instant run enabled:

minifyEnabled true useProguard true shrinkResources false 

So this tends to happen when instant Run is enabled and shrinkResources is set to true as well.

like image 41
Jerry Okafor Avatar answered Oct 04 '22 13:10

Jerry Okafor