Неудовлетворительные ограничения версии с androidTestImplementation Google Truth 1.0 и реализацией Google Guava 27.0.1 - PullRequest
1 голос
/ 05 ноября 2019

Короче говоря

Я не могу получить минимальный и новый Android Studio проект для сборки со следующими добавленными зависимостями:

dependencies {
    ...
    implementation 'com.google.guava:guava:27.0.1-android'
    androidTestImplementation "com.google.truth:truth:1.0"
}

Как воспроизвести

Это то, как я это делаю, но есть и другие способы.

  1. В Android Studio 3.5.2 :
    1. Файл Новый Новый проект ...
  2. В Диалог создания нового объекта :
    1. Телефон и планшет * Вкладка 1032 * → Добавить Нет активности Далее
    2. Имя , Имя пакета , Сохранить местоположение : Все, что вы хотите
    3. Язык : Java
    4. Минимальный уровень API : API 28
    5. Этот проект будет поддерживать мгновенные приложения : Отключено
    6. Готово
  3. В . / App / build.gradle :
    1. Добавить implementation 'com.google.guava:guava:27.0.1-android' и androidTestImplementation "com.google.truth:truth:1.0" вdependencies
  4. In ExampleInstrumentedTest.java
    1. Щелкните правой кнопкой мыши по class ExampleInstrumentedTest и выберите Запустить 'ExampleInstrumentedTest'

Ожидается
Тест пройден

Фактический
Ошибка сборки:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:preDebugAndroidTestBuild'.
> Could not resolve all task dependencies for configuration ':app:debugAndroidTestRuntimeClasspath'.
   > Could not resolve org.checkerframework:checker-compat-qual:{strictly 2.5.2}.
     Required by:
         project :app
      > Cannot find a version of 'org.checkerframework:checker-compat-qual' that satisfies the version constraints: 
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.truth:truth:1.0' --> 'org.checkerframework:checker-compat-qual:2.5.5'
           Constraint path 'sdfsf:app:unspecified' --> 'org.checkerframework:checker-compat-qual:{strictly 2.5.2}' because of the following reason: debugRuntimeClasspath uses version 2.5.2
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.guava:guava:27.0.1-android' --> 'org.checkerframework:checker-compat-qual:2.5.2'

   > Could not resolve com.google.errorprone:error_prone_annotations:{strictly 2.2.0}.
     Required by:
         project :app
      > Cannot find a version of 'com.google.errorprone:error_prone_annotations' that satisfies the version constraints: 
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.truth:truth:1.0' --> 'com.google.errorprone:error_prone_annotations:2.3.1'
           Constraint path 'sdfsf:app:unspecified' --> 'com.google.errorprone:error_prone_annotations:{strictly 2.2.0}' because of the following reason: debugRuntimeClasspath uses version 2.2.0
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.guava:guava:27.0.1-android' --> 'com.google.errorprone:error_prone_annotations:2.2.0'

   > Could not resolve org.checkerframework:checker-compat-qual:2.5.5.
     Required by:
         project :app > com.google.truth:truth:1.0
      > Cannot find a version of 'org.checkerframework:checker-compat-qual' that satisfies the version constraints: 
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.truth:truth:1.0' --> 'org.checkerframework:checker-compat-qual:2.5.5'
           Constraint path 'sdfsf:app:unspecified' --> 'org.checkerframework:checker-compat-qual:{strictly 2.5.2}' because of the following reason: debugRuntimeClasspath uses version 2.5.2
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.guava:guava:27.0.1-android' --> 'org.checkerframework:checker-compat-qual:2.5.2'

   > Could not resolve com.google.errorprone:error_prone_annotations:2.3.1.
     Required by:
         project :app > com.google.truth:truth:1.0
      > Cannot find a version of 'com.google.errorprone:error_prone_annotations' that satisfies the version constraints: 
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.truth:truth:1.0' --> 'com.google.errorprone:error_prone_annotations:2.3.1'
           Constraint path 'sdfsf:app:unspecified' --> 'com.google.errorprone:error_prone_annotations:{strictly 2.2.0}' because of the following reason: debugRuntimeClasspath uses version 2.2.0
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.guava:guava:27.0.1-android' --> 'com.google.errorprone:error_prone_annotations:2.2.0'

   > Could not resolve org.checkerframework:checker-compat-qual:2.5.2.
     Required by:
         project :app > com.google.guava:guava:27.0.1-android
      > Cannot find a version of 'org.checkerframework:checker-compat-qual' that satisfies the version constraints: 
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.truth:truth:1.0' --> 'org.checkerframework:checker-compat-qual:2.5.5'
           Constraint path 'sdfsf:app:unspecified' --> 'org.checkerframework:checker-compat-qual:{strictly 2.5.2}' because of the following reason: debugRuntimeClasspath uses version 2.5.2
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.guava:guava:27.0.1-android' --> 'org.checkerframework:checker-compat-qual:2.5.2'

   > Could not resolve com.google.errorprone:error_prone_annotations:2.2.0.
     Required by:
         project :app > com.google.guava:guava:27.0.1-android
      > Cannot find a version of 'com.google.errorprone:error_prone_annotations' that satisfies the version constraints: 
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.truth:truth:1.0' --> 'com.google.errorprone:error_prone_annotations:2.3.1'
           Constraint path 'sdfsf:app:unspecified' --> 'com.google.errorprone:error_prone_annotations:{strictly 2.2.0}' because of the following reason: debugRuntimeClasspath uses version 2.2.0
           Dependency path 'sdfsf:app:unspecified' --> 'com.google.guava:guava:27.0.1-android' --> 'com.google.errorprone:error_prone_annotations:2.2.0'

Как я могу исправить эту проблему сборки?

1 Ответ

1 голос
/ 07 ноября 2019

Решение было смущающе простым. Просто используйте 'com.google.guava:guava:28.1-android' вместо 'com.google.guava:guava:27.0.1-android'.

...