Gradle не удалось разрешить библиотеку AndroidX в Java-библиотекеJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Gradle не удалось разрешить библиотеку AndroidX в Java-библиотеке

Сообщение Anonymous »

Я работаю над настройкой инструментальных тестов в своем проекте Gradle библиотеки Java, используя библиотеку androidx.test. Я добавил следующую зависимость в свой файл build.gradle:
plugins {
id 'java-library'
}

repositories {
google()
mavenCentral()
}

dependencies {
implementation 'androidx.test:runner:1.6.2'
}

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:runner:1.6.2
project :lib > androidx.test:runner:1.6.2 > androidx.test:monitor:1.7.2

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:runner:1.6.2
+--- 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:runner:1.6.2 (n)

mainSourceElements - List of source directories contained in the Main SourceSet. (n)
No dependencies

runtimeClasspath - Runtime classpath of source set 'main'.
\--- androidx.test:runner:1.6.2
+--- 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:runner:1.6.2
+--- 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:runner:1.6.2
+--- 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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»