更新项目后,每行执行测试命令时出错

问题描述 投票:0回答:1

我有一个包含多个模块的项目。 在过去的几天里,我决定更新项目,更新 gradlew、libs 后,我发现我的测试命令停止工作。 我觉得是我jacoco的问题,无法确认。

./gradlew assemblePrdDebug testPrdDebug jacocoTestPrdDebugUnitTestReport sonarqube --stacktrace
./gradlew assemblePrdDebug testPrdDebug createDebugCoverageReport sonarqube --stacktrace
./gradlew clean test createDebugCoverageReport jacocoTestReport --info --stacktrace --warning-mode all
./gradlew jacocoCombinedTestReports
./gradlew tasks
./gradlew jacocoReport 
./gradlew testVariantNameUnitTest --tests
./gradlew :data:connectedPrdDebugAndroidTest
./gradlew :common:testDebugUnitTest
./gradlew :data:connectedPrdDebugAndroidTest --stacktrace --info --scan

这些命令都不起作用,我也遇到同样的错误。

如果我使用“运行所有测试”快捷方式,一切都会正常。 但问题是我使用管道并且测试必须从命令行运行

https://scans.gradle.com/s/addpqorjoaaao/failure#1


Could not resolve all files for configuration ':classpath'.
> Could not resolve androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0.
  Required by:
      project :
  > No matching variant of androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.2' but:
      - Variant 'apiElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0 declares a library, packaged as a jar, and its dependencies declared externally:
          - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11
          - Other compatible attribute:
              - Doesn't say anything about org.gradle.plugin.api-version (required '8.2')
      - Variant 'runtimeElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
          - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
          - Other compatible attribute:
              - Doesn't say anything about org.gradle.plugin.api-version (required '8.2')
      - Variant 'sourcesElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0 declares a component for use during runtime, and its dependencies declared externally:
          - Incompatible because this component declares documentation and the consumer needed a library
          - Other compatible attributes:
              - Doesn't say anything about its target Java version (required compatibility with Java 11)
              - Doesn't say anything about its elements (required them packaged as a jar)
              - Doesn't say anything about org.gradle.plugin.api-version (required '8.2')
Exception
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'canais-mobile-android'.  
at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:84)  
•••
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':classpath'.   
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.mapFailure(DefaultConfiguration.java:1769) 
•••
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0.   
Required by:    
    project :   
Caused by: org.gradle.internal.component.NoMatchingConfigurationSelectionException: No matching variant of androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.2' but:   
  - Variant 'apiElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0 declares a library, packaged as a jar, and its dependencies declared externally:  
      - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11   
      - Other compatible attribute: ...
android kotlin android-studio
1个回答
0
投票

已解决

JAVA_HOME == jdk 17

const val safeArgs = "2.5.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.safeArgs}"
© www.soinside.com 2019 - 2024. All rights reserved.