Круговая зависимость между следующими задачами
Я пытаюсь решить эту проблему более 5 часов. В чем может быть проблема?
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)
Я добавил:
org.gradle.configureondemand = верно
Но проблема все еще присутствует
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:[email protected]') {
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:[email protected]'
//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:[email protected]'
//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'
}
и build.gradle(Project: myproject)
//Файл сборки верхнего уровня, где вы можете добавить параметры конфигурации, общие для всех подпроектов/модулей.
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' }
Ответы
Ответ 1
Но minifyEnabled важен в производстве. Я пробовал следующую компоновку и работал с включенным мгновенным запуском:
minifyEnabled true
useProguard true
shrinkResources false
Таким образом, это имеет тенденцию происходить, когда мгновенный запуск включен и усадкаResources также имеет значение true.
Ответ 2
Это может произойти, когда модуль зависит от самого себя!
Например, предположим, что это для модуля app
:
...
dependencies {
compile project(':app') // !!!
...
}
Ответ 3
Я решил эту проблему. Просто нужно было заменить
minifyEnabled true
useProguard true
shrinkResources true
на
minifyEnabled false
useProguard false
shrinkResources false
Ответ 4
minified, userProguard, сжатие ресурсов может привести к ошибкам в режиме отладки. Эти функции необходимы для использования в версии Release. Поэтому вам нужно отключить их, или вы можете добавить debuggable = false.
debug {
minifyEnabled true
useProguard true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
Ответ 5
Я посмотрел на структуру проекта (Ctrl + Shift + Alt + S) и удалил импортированный модуль> синхронизировать проект и файлы Gradle
добавить build.gradle Module:app
implementation project(':app')