gpt4 book ai didi

Android Studio : Could not find org. jacoco :org. jacoco.agent :org. gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:07:29 32 4
gpt4 key购买 nike

我正在尝试将 JaCoCo 添加到我的 Android 以覆盖 Sonar Qube。但是在运行命令 ./gradlew jacocoTestReport 时,我收到以下错误。

 Task :app:testAlphaReleaseUnitTest FAILED


FAILURE: Build failed with an exception.

出了什么问题:

Could not resolve all files for configuration ':app:jacocoAgent'.
> Could not find org.jacoco:org.jacoco.agent:org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.
Searched in the following locations:
- file:/Users/atif/Library/Android/sdk/extras/m2repository/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- file:/Users/atif/Library/Android/sdk/extras/m2repository/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
- file:/Users/atif/Library/Android/sdk/extras/google/m2repository/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- file:/Users/atif/Library/Android/sdk/extras/google/m2repository/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
- file:/Users/atif/Library/Android/sdk/extras/android/m2repository/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- file:/Users/atif/Library/Android/sdk/extras/android/m2repository/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
- https://jcenter.bintray.com/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- https://jcenter.bintray.com/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
- https://dl.google.com/dl/android/maven2/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- https://dl.google.com/dl/android/maven2/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
- https://maven.fabric.io/public/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- https://maven.fabric.io/public/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
- https://jcenter.bintray.com/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- https://jcenter.bintray.com/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
- https://maven.fabric.io/public/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- https://maven.fabric.io/public/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
- https://dl.google.com/dl/android/maven2/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- https://dl.google.com/dl/android/maven2/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
- https://repo.maven.apache.org/maven2/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.pom
- https://repo.maven.apache.org/maven2/org/jacoco/org.jacoco.agent/org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated/org.jacoco.agent-org.gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated.421021a4
Required by:
project :app

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

这是我的 gradle 文件:

项目build.gradle

buildscript{
dependencies {
classpath "org.jacoco:org.jacoco.core:0.8.2"
classpath "org.jacoco:org.jacoco.agent:0.8.2"
}
}

plugins {
id "jacoco"
}

应用构建.gradle:

plugins {
id "com.android.application"
id "jacoco-android"
id "org.sonarqube" version "2.6"
}

android {
buildTypes {
debug {
testCoverageEnabled = true
}
}
}

android.testOptions {
unitTests.all {
jacoco {
includeNoLocationClasses = true
}
}
}

jacoco {
toolVersion = "0.8.2"
reportsDir = file("$buildDir/reports/jacoco/")
}

jacocoAndroidUnitTestReport {
csv.enabled false
html.enabled false
xml.enabled true
}

最佳答案

一个是Gradle插件,属于根项目的buildscript依赖:

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.dicedmelon.gradle:jacoco-android:0.1.4"
classpath "com.android.tools.build:gradle:3.2.1"
classpath "org.jacoco:org.jacoco.core:0.8.3"
...
}
}

另一个是库,属于模块的Java依赖:

apply plugin: "com.android.application"
// apply plugin "jacoco"
apply plugin: "jacoco-android"

...

dependencies {
...
testImplementation "org.jacoco:org.jacoco.agent:0.8.3"
}

jacoco-android GitHub 对 apply plugin "jacoco" 只字未提,但它可能是必需的。

关于Android Studio : Could not find org. jacoco :org. jacoco.agent :org. gradle.testing.jacoco.plugins.JacocoPluginExtension_Decorated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54903318/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com