Конфликт зависимостей Android Studio (тип программы уже присутствует)
У меня был RecyclerView
в моем проекте, и я не могу его построить.
Вот мой файл build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "app_name"
minSdkVersion 27
targetSdkVersion 27
versionCode 5
versionName "1.0.4"
}
buildTypes {
release {
initWith(buildTypes.debug)
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
// implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
compileOnly 'com.google.android.things:androidthings:1.0'
implementation 'com.google.android.things.contrib:driver-bmx280:1.0'
implementation 'com.google.android.things.contrib:driver-button:1.0'
implementation 'com.google.android.things:cloud-iot-core:1.0.0'
implementation 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
}
Когда я строю, я добавляю одно из этих трех сообщений:
Тип программы уже присутствует: android.support.v4.content.Loader Сообщение {kind=ERROR, text= Тип программы уже присутствует: android.support.v4.content.Loader, sources=[Неизвестный исходный файл], имя инструмента = Необязательно. из (D8)}
Тип программы уже присутствует: android.support.v4.app.TaskStackBuilder Сообщение {kind=ERROR, text= Тип программы уже присутствует: android.support.v4.app.TaskStackBuilder, sources = [Неизвестный исходный файл], имя инструмента = Необязательно. из (D8)}
Тип программы уже присутствует: android.support.v4.content.LocalBroadcastManager $ ReceiverRecord Сообщение {kind=ERROR, text= Тип программы уже присутствует: android.support.v4.content.LocalBroadcastManager $ ReceiverRecord, sources = [Неизвестный исходный файл], инструмент имя =Optional.of(D8)}
Я пытался исключить эту зависимость с помощью:
implementation ('com.android.support:recyclerview-v7:27.1.1') {
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'android.support.v4.content.Loader'
exclude module: 'android.support.v4.content.LocalBroadcastManager$ReceiverRecord'
exclude module: 'android.support.v4.app.TaskStackBuilder'
}
Но у меня все та же ошибка. Как я могу сделать это исправить?
Редактировать: я сделал androidDependencies в Android Studio и получил это:
Executing tasks: [androidDependencies]
Configuration on demand is an incubating feature.
:app:androidDependencies
debug
debugCompileClasspath - Dependencies for compilation
+--- com.google.android.things:androidthings:1.0@jar
+--- com.android.support.constraint:constraint-layout:1.1.2@aar
+--- com.android.support:recyclerview-v7:27.1.1@aar
+--- com.android.support:support-v4:27.1.1@aar
+--- com.google.android.things.contrib:driver-bmx280:1.0@aar
+--- com.google.android.things.contrib:driver-button:1.0@aar
+--- com.google.android.things:cloud-iot-core:1.0.0@aar
+--- com.eclipsesource.minimal-json:minimal-json:0.9.5@jar
+--- com.android.support:multidex:1.0.3@aar
+--- com.android.support.constraint:constraint-layout-solver:1.1.2@jar
+--- com.android.support:support-fragment:27.1.1@aar
+--- com.android.support:support-core-ui:27.1.1@aar
+--- com.android.support:support-media-compat:27.1.1@aar
+--- com.android.support:support-core-utils:27.1.1@aar
+--- com.android.support:support-compat:27.1.1@aar
+--- com.android.support:support-annotations:27.1.1@jar
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2@jar
+--- org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0@jar
+--- org.bitbucket.b_c:jose4j:0.6.3@jar
+--- android.arch.lifecycle:runtime:1.1.0@aar
+--- android.arch.lifecycle:livedata-core:1.1.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.0@aar
+--- com.google.android:support-v4:r7@jar
+--- org.slf4j:slf4j-api:1.7.21@jar
+--- android.arch.lifecycle:common:1.1.0@jar
+--- android.arch.core:runtime:1.1.0@aar
\--- android.arch.core:common:1.1.0@jar
debugRuntimeClasspath - Dependencies for runtime/packaging
+--- com.android.support.constraint:constraint-layout:1.1.2@aar
+--- com.android.support:recyclerview-v7:27.1.1@aar
+--- com.android.support:support-v4:27.1.1@aar
+--- com.google.android.things.contrib:driver-bmx280:1.0@aar
+--- com.google.android.things.contrib:driver-button:1.0@aar
+--- com.google.android.things:cloud-iot-core:1.0.0@aar
+--- com.eclipsesource.minimal-json:minimal-json:0.9.5@jar
+--- com.android.support:multidex:1.0.3@aar
+--- com.android.support.constraint:constraint-layout-solver:1.1.2@jar
+--- com.android.support:support-fragment:27.1.1@aar
+--- com.android.support:support-core-ui:27.1.1@aar
+--- com.android.support:support-media-compat:27.1.1@aar
+--- com.android.support:support-core-utils:27.1.1@aar
+--- com.android.support:support-compat:27.1.1@aar
+--- com.android.support:support-annotations:27.1.1@jar
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2@jar
+--- org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0@jar
+--- org.bitbucket.b_c:jose4j:0.6.3@jar
+--- android.arch.lifecycle:runtime:1.1.0@aar
+--- android.arch.lifecycle:livedata-core:1.1.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.0@aar
+--- com.google.android:support-v4:r7@jar
+--- org.slf4j:slf4j-api:1.7.21@jar
+--- android.arch.lifecycle:common:1.1.0@jar
+--- android.arch.core:runtime:1.1.0@aar
\--- android.arch.core:common:1.1.0@jar
debugAndroidTest
debugAndroidTestCompileClasspath - Dependencies for compilation
+--- com.android.support.constraint:constraint-layout:1.1.2@aar
+--- com.android.support:recyclerview-v7:27.1.1@aar
+--- com.android.support:support-v4:27.1.1@aar
+--- com.google.android.things.contrib:driver-bmx280:1.0@aar
+--- com.google.android.things.contrib:driver-button:1.0@aar
+--- com.google.android.things:cloud-iot-core:1.0.0@aar
+--- com.eclipsesource.minimal-json:minimal-json:0.9.5@jar
+--- com.android.support:multidex:1.0.3@aar
+--- com.android.support.constraint:constraint-layout-solver:1.1.2@jar
+--- com.android.support:support-fragment:27.1.1@aar
+--- com.android.support:support-core-ui:27.1.1@aar
+--- com.android.support:support-media-compat:27.1.1@aar
+--- com.android.support:support-core-utils:27.1.1@aar
+--- com.android.support:support-compat:27.1.1@aar
+--- com.android.support:support-annotations:27.1.1@jar
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2@jar
+--- org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0@jar
+--- org.bitbucket.b_c:jose4j:0.6.3@jar
+--- android.arch.lifecycle:runtime:1.1.0@aar
+--- android.arch.lifecycle:livedata-core:1.1.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.0@aar
+--- com.google.android:support-v4:r7@jar
+--- org.slf4j:slf4j-api:1.7.21@jar
+--- android.arch.lifecycle:common:1.1.0@jar
+--- android.arch.core:runtime:1.1.0@aar
\--- android.arch.core:common:1.1.0@jar
debugAndroidTestRuntimeClasspath - Dependencies for runtime/packaging
debugUnitTest
debugUnitTestCompileClasspath - Dependencies for compilation
+--- com.android.support.constraint:constraint-layout:1.1.2@aar
+--- com.android.support:recyclerview-v7:27.1.1@aar
+--- com.android.support:support-v4:27.1.1@aar
+--- com.google.android.things.contrib:driver-bmx280:1.0@aar
+--- com.google.android.things.contrib:driver-button:1.0@aar
+--- com.google.android.things:cloud-iot-core:1.0.0@aar
+--- com.eclipsesource.minimal-json:minimal-json:0.9.5@jar
+--- com.android.support:multidex:1.0.3@aar
+--- junit:junit:4.12@jar
+--- com.android.support.constraint:constraint-layout-solver:1.1.2@jar
+--- com.android.support:support-fragment:27.1.1@aar
+--- com.android.support:support-core-ui:27.1.1@aar
+--- com.android.support:support-media-compat:27.1.1@aar
+--- com.android.support:support-core-utils:27.1.1@aar
+--- com.android.support:support-compat:27.1.1@aar
+--- com.android.support:support-annotations:27.1.1@jar
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2@jar
+--- org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0@jar
+--- org.bitbucket.b_c:jose4j:0.6.3@jar
+--- org.hamcrest:hamcrest-core:1.3@jar
+--- android.arch.lifecycle:runtime:1.1.0@aar
+--- android.arch.lifecycle:livedata-core:1.1.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.0@aar
+--- com.google.android:support-v4:r7@jar
+--- org.slf4j:slf4j-api:1.7.21@jar
+--- android.arch.lifecycle:common:1.1.0@jar
+--- android.arch.core:runtime:1.1.0@aar
\--- android.arch.core:common:1.1.0@jar
debugUnitTestRuntimeClasspath - Dependencies for runtime/packaging
+--- com.android.support.constraint:constraint-layout:1.1.2@aar
+--- com.android.support:recyclerview-v7:27.1.1@aar
+--- com.android.support:support-v4:27.1.1@aar
+--- com.google.android.things.contrib:driver-bmx280:1.0@aar
+--- com.google.android.things.contrib:driver-button:1.0@aar
+--- com.google.android.things:cloud-iot-core:1.0.0@aar
+--- com.eclipsesource.minimal-json:minimal-json:0.9.5@jar
+--- com.android.support:multidex:1.0.3@aar
+--- junit:junit:4.12@jar
+--- com.android.support.constraint:constraint-layout-solver:1.1.2@jar
+--- com.android.support:support-fragment:27.1.1@aar
+--- com.android.support:support-core-ui:27.1.1@aar
+--- com.android.support:support-media-compat:27.1.1@aar
+--- com.android.support:support-core-utils:27.1.1@aar
+--- com.android.support:support-compat:27.1.1@aar
+--- com.android.support:support-annotations:27.1.1@jar
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2@jar
+--- org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0@jar
+--- org.bitbucket.b_c:jose4j:0.6.3@jar
+--- org.hamcrest:hamcrest-core:1.3@jar
+--- android.arch.lifecycle:runtime:1.1.0@aar
+--- android.arch.lifecycle:livedata-core:1.1.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.0@aar
+--- com.google.android:support-v4:r7@jar
+--- org.slf4j:slf4j-api:1.7.21@jar
+--- android.arch.lifecycle:common:1.1.0@jar
+--- android.arch.core:runtime:1.1.0@aar
\--- android.arch.core:common:1.1.0@jar
release
releaseCompileClasspath - Dependencies for compilation
+--- com.google.android.things:androidthings:1.0@jar
+--- com.android.support.constraint:constraint-layout:1.1.2@aar
+--- com.android.support:recyclerview-v7:27.1.1@aar
+--- com.android.support:support-v4:27.1.1@aar
+--- com.google.android.things.contrib:driver-bmx280:1.0@aar
+--- com.google.android.things.contrib:driver-button:1.0@aar
+--- com.google.android.things:cloud-iot-core:1.0.0@aar
+--- com.eclipsesource.minimal-json:minimal-json:0.9.5@jar
+--- com.android.support:multidex:1.0.3@aar
+--- com.android.support.constraint:constraint-layout-solver:1.1.2@jar
+--- com.android.support:support-fragment:27.1.1@aar
+--- com.android.support:support-core-ui:27.1.1@aar
+--- com.android.support:support-media-compat:27.1.1@aar
+--- com.android.support:support-core-utils:27.1.1@aar
+--- com.android.support:support-compat:27.1.1@aar
+--- com.android.support:support-annotations:27.1.1@jar
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2@jar
+--- org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0@jar
+--- org.bitbucket.b_c:jose4j:0.6.3@jar
+--- android.arch.lifecycle:runtime:1.1.0@aar
+--- android.arch.lifecycle:livedata-core:1.1.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.0@aar
+--- com.google.android:support-v4:r7@jar
+--- org.slf4j:slf4j-api:1.7.21@jar
+--- android.arch.lifecycle:common:1.1.0@jar
+--- android.arch.core:runtime:1.1.0@aar
\--- android.arch.core:common:1.1.0@jar
releaseRuntimeClasspath - Dependencies for runtime/packaging
+--- com.android.support.constraint:constraint-layout:1.1.2@aar
+--- com.android.support:recyclerview-v7:27.1.1@aar
+--- com.android.support:support-v4:27.1.1@aar
+--- com.google.android.things.contrib:driver-bmx280:1.0@aar
+--- com.google.android.things.contrib:driver-button:1.0@aar
+--- com.google.android.things:cloud-iot-core:1.0.0@aar
+--- com.eclipsesource.minimal-json:minimal-json:0.9.5@jar
+--- com.android.support:multidex:1.0.3@aar
+--- com.android.support.constraint:constraint-layout-solver:1.1.2@jar
+--- com.android.support:support-fragment:27.1.1@aar
+--- com.android.support:support-core-ui:27.1.1@aar
+--- com.android.support:support-media-compat:27.1.1@aar
+--- com.android.support:support-core-utils:27.1.1@aar
+--- com.android.support:support-compat:27.1.1@aar
+--- com.android.support:support-annotations:27.1.1@jar
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2@jar
+--- org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0@jar
+--- org.bitbucket.b_c:jose4j:0.6.3@jar
+--- android.arch.lifecycle:runtime:1.1.0@aar
+--- android.arch.lifecycle:livedata-core:1.1.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.0@aar
+--- com.google.android:support-v4:r7@jar
+--- org.slf4j:slf4j-api:1.7.21@jar
+--- android.arch.lifecycle:common:1.1.0@jar
+--- android.arch.core:runtime:1.1.0@aar
\--- android.arch.core:common:1.1.0@jar
releaseUnitTest
releaseUnitTestCompileClasspath - Dependencies for compilation
+--- com.android.support.constraint:constraint-layout:1.1.2@aar
+--- com.android.support:recyclerview-v7:27.1.1@aar
+--- com.android.support:support-v4:27.1.1@aar
+--- com.google.android.things.contrib:driver-bmx280:1.0@aar
+--- com.google.android.things.contrib:driver-button:1.0@aar
+--- com.google.android.things:cloud-iot-core:1.0.0@aar
+--- com.eclipsesource.minimal-json:minimal-json:0.9.5@jar
+--- com.android.support:multidex:1.0.3@aar
+--- junit:junit:4.12@jar
+--- com.android.support.constraint:constraint-layout-solver:1.1.2@jar
+--- com.android.support:support-fragment:27.1.1@aar
+--- com.android.support:support-core-ui:27.1.1@aar
+--- com.android.support:support-media-compat:27.1.1@aar
+--- com.android.support:support-core-utils:27.1.1@aar
+--- com.android.support:support-compat:27.1.1@aar
+--- com.android.support:support-annotations:27.1.1@jar
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2@jar
+--- org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0@jar
+--- org.bitbucket.b_c:jose4j:0.6.3@jar
+--- org.hamcrest:hamcrest-core:1.3@jar
+--- android.arch.lifecycle:runtime:1.1.0@aar
+--- android.arch.lifecycle:livedata-core:1.1.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.0@aar
+--- com.google.android:support-v4:r7@jar
+--- org.slf4j:slf4j-api:1.7.21@jar
+--- android.arch.lifecycle:common:1.1.0@jar
+--- android.arch.core:runtime:1.1.0@aar
\--- android.arch.core:common:1.1.0@jar
releaseUnitTestRuntimeClasspath - Dependencies for runtime/packaging
+--- com.android.support.constraint:constraint-layout:1.1.2@aar
+--- com.android.support:recyclerview-v7:27.1.1@aar
+--- com.android.support:support-v4:27.1.1@aar
+--- com.google.android.things.contrib:driver-bmx280:1.0@aar
+--- com.google.android.things.contrib:driver-button:1.0@aar
+--- com.google.android.things:cloud-iot-core:1.0.0@aar
+--- com.eclipsesource.minimal-json:minimal-json:0.9.5@jar
+--- com.android.support:multidex:1.0.3@aar
+--- junit:junit:4.12@jar
+--- com.android.support.constraint:constraint-layout-solver:1.1.2@jar
+--- com.android.support:support-fragment:27.1.1@aar
+--- com.android.support:support-core-ui:27.1.1@aar
+--- com.android.support:support-media-compat:27.1.1@aar
+--- com.android.support:support-core-utils:27.1.1@aar
+--- com.android.support:support-compat:27.1.1@aar
+--- com.android.support:support-annotations:27.1.1@jar
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2@jar
+--- org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0@jar
+--- org.bitbucket.b_c:jose4j:0.6.3@jar
+--- org.hamcrest:hamcrest-core:1.3@jar
+--- android.arch.lifecycle:runtime:1.1.0@aar
+--- android.arch.lifecycle:livedata-core:1.1.0@aar
+--- android.arch.lifecycle:viewmodel:1.1.0@aar
+--- com.google.android:support-v4:r7@jar
+--- org.slf4j:slf4j-api:1.7.21@jar
+--- android.arch.lifecycle:common:1.1.0@jar
+--- android.arch.core:runtime:1.1.0@aar
\--- android.arch.core:common:1.1.0@jar
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
15:29:36: Task execution finished 'androidDependencies'.
2 ответа
Ответы было написать:
implementation ('com.google.android.things:cloud-iot-core:1.0.0') {
exclude module: 'support-v4'
}
'support-v4' - это внутренняя зависимость cloud-iot-core.
Вы проверили свой график зависимостей, чтобы указать дубликаты?