plugins {
id 'java-library'
}
repositories {
google()
mavenCentral()
}
dependencies {
implementation 'androidx.test
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
Однако Gradle не может разрешить некоторые из своих транзитивных зависимостей, что приводит к сбоям сборки. Я новичок в Gradle и не знаю, как устранить эти недостающие зависимости.
Вот сообщение об ошибке, которое я получаю:
:lib:test: Could not resolve androidx.tracing:tracing:1.1.0.
Required by:
project :lib > androidx.test
project :lib > androidx.test
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/usergui ... ories.html
Что я пробовал:
- Очистка кэша Gradle.
- Аннулируйте и перезапустите Android Studio.
- Проверка последней версии androidx.test:runner.
Вопросы:
[*]Как настроить Gradle для правильного разрешения транзитивных зависимостей для androidx.test?
[*]Нужно ли вручную добавлять недостающие зависимости или есть способ обеспечить автоматическое получение всех необходимых библиотек?
Ссылка на репозиторий Maven, которую я пытаюсь импортировать
Вывод ./gradlew :lib:dependent
> Task :lib:dependencies
------------------------------------------------------------
Project ':lib'
------------------------------------------------------------
annotationProcessor - Annotation processors and their dependencies for source set 'main'.
No dependencies
api - API dependencies for the 'main' feature. (n)
No dependencies
apiElements - API elements for the 'main' feature. (n)
No dependencies
compileClasspath - Compile classpath for source set 'main'.
\--- androidx.test
+--- androidx.annotation:annotation:1.7.0-beta01
| \--- androidx.annotation:annotation-jvm:1.7.0-beta01
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 -> 1.8.20
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.8.20
| \--- org.jetbrains:annotations:13.0
+--- androidx.test.services:storage:1.5.0
| +--- androidx.annotation:annotation:1.7.0-beta01 (*)
| \--- androidx.test:monitor:1.7.0 -> 1.7.2
| +--- androidx.annotation:annotation:1.7.0-beta01 (*)
| +--- androidx.tracing:tracing:1.1.0 FAILED
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.20 (*)
+--- androidx.test:monitor:1.7.2 (*)
+--- androidx.tracing:tracing:1.1.0 FAILED
\--- junit:junit:4.13.2
\--- org.hamcrest:hamcrest-core:1.3
compileOnly - Compile-only dependencies for the 'main' feature. (n)
No dependencies
compileOnlyApi - Compile-only API dependencies for the 'main' feature. (n)
No dependencies
default - Configuration for default artifacts. (n)
No dependencies
implementation - Implementation dependencies for the 'main' feature. (n)
\--- androidx.test
mainSourceElements - List of source directories contained in the Main SourceSet. (n)
No dependencies
runtimeClasspath - Runtime classpath of source set 'main'.
\--- androidx.test
+--- androidx.annotation:annotation:1.7.0-beta01
| \--- androidx.annotation:annotation-jvm:1.7.0-beta01
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 -> 1.8.20
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.8.20
| \--- org.jetbrains:annotations:13.0
+--- androidx.test.services:storage:1.5.0
| +--- androidx.annotation:annotation:1.7.0-beta01 (*)
| \--- androidx.test:monitor:1.7.0 -> 1.7.2
| +--- androidx.annotation:annotation:1.7.0-beta01 (*)
| +--- androidx.tracing:tracing:1.1.0 FAILED
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.20 (*)
+--- androidx.test:monitor:1.7.2 (*)
+--- androidx.tracing:tracing:1.1.0 FAILED
\--- junit:junit:4.13.2
\--- org.hamcrest:hamcrest-core:1.3
runtimeElements - Runtime elements for the 'main' feature. (n)
No dependencies
runtimeOnly - Runtime-only dependencies for the 'main' feature. (n)
No dependencies
testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
No dependencies
testCompileClasspath - Compile classpath for source set 'test'.
\--- androidx.test
+--- androidx.annotation:annotation:1.7.0-beta01
| \--- androidx.annotation:annotation-jvm:1.7.0-beta01
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 -> 1.8.20
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.8.20
| \--- org.jetbrains:annotations:13.0
+--- androidx.test.services:storage:1.5.0
| +--- androidx.annotation:annotation:1.7.0-beta01 (*)
| \--- androidx.test:monitor:1.7.0 -> 1.7.2
| +--- androidx.annotation:annotation:1.7.0-beta01 (*)
| +--- androidx.tracing:tracing:1.1.0 FAILED
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.20 (*)
+--- androidx.test:monitor:1.7.2 (*)
+--- androidx.tracing:tracing:1.1.0 FAILED
\--- junit:junit:4.13.2
\--- org.hamcrest:hamcrest-core:1.3
testCompileOnly - Compile only dependencies for source set 'test'. (n)
No dependencies
testImplementation - Implementation only dependencies for source set 'test'. (n)
No dependencies
testRuntimeClasspath - Runtime classpath of source set 'test'.
\--- androidx.test
+--- androidx.annotation:annotation:1.7.0-beta01
| \--- androidx.annotation:annotation-jvm:1.7.0-beta01
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.7.10 -> 1.8.20
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.8.20
| \--- org.jetbrains:annotations:13.0
+--- androidx.test.services:storage:1.5.0
| +--- androidx.annotation:annotation:1.7.0-beta01 (*)
| \--- androidx.test:monitor:1.7.0 -> 1.7.2
| +--- androidx.annotation:annotation:1.7.0-beta01 (*)
| +--- androidx.tracing:tracing:1.1.0 FAILED
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.20 (*)
+--- androidx.test:monitor:1.7.2 (*)
+--- androidx.tracing:tracing:1.1.0 FAILED
\--- junit:junit:4.13.2
\--- org.hamcrest:hamcrest-core:1.3
testRuntimeOnly - Runtime only dependencies for source set 'test'. (n)
No dependencies
(*) - Indicates repeated occurrences of a transitive dependency subtree. Gradle expands transitive dependency subtrees only once per project; repeat occurrences only display the root of the subtree, followed by this annotation.
(n) - A dependency or dependency configuration that cannot be resolved.
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 666ms
1 actionable task: 1 executed
Подробнее здесь: https://stackoverflow.com/questions/790 ... va-library
Мобильная версия