Android 迁移到junit5后无法运行测试

Android 迁移到junit5后无法运行测试,android,gradle,junit5,Android,Gradle,Junit5,我正在使用gradle在android上运行测试,我们正在将我们的框架迁移到junit5,以利用它的一些标记和过滤功能。我已经在build.gradle文件中创建了依赖项,并且我能够使用android studio中的排水沟图标来构建和运行它,但是我无法从命令行运行测试。我得到以下错误 * What went wrong: Execution failed for task ':app:compileTestKotlin'. > Could not resolve all fi

我正在使用gradle在android上运行测试,我们正在将我们的框架迁移到junit5,以利用它的一些标记和过滤功能。我已经在build.gradle文件中创建了依赖项,并且我能够使用android studio中的排水沟图标来构建和运行它,但是我无法从命令行运行测试。我得到以下错误

    * What went wrong:
 Execution failed for task ':app:compileTestKotlin'.
 > Could not resolve all files for configuration ':app:testCompileClasspath'.
    > Could not find junit:junit:5.7.0.
      Searched in the following locations:
        - https://jcenter.bintray.com/junit/junit/5.7.0/junit-5.7.0.pom
        - https://jcenter.bintray.com/junit/junit/5.7.0/junit-5.7.0.jar
        - https://repo.maven.apache.org/maven2/junit/junit/5.7.0/junit-5.7.0.pom
        - https://repo.maven.apache.org/maven2/junit/junit/5.7.0/junit-5.7.0.jar
      Required by:
          project :app
这是我在应用程序级别的build.gradle

plugins {
    id 'io.qameta.allure' version '2.8.1' // Latest Plugin Version
    id 'java'
}

allure {
    autoconfigure = true
    version = '2.13.7'  // Latest Allure Version

    useJUnit5 {
        version = '2.13.7' // Latest Allure Version
    }

}

sourceCompatibility = 1.8

repositories {
    jcenter()
    mavenCentral()
}

dependencies {
    testImplementation(
            'org.junit.jupiter:junit-jupiter-params:5.7.0',
            'org.junit.jupiter:junit-jupiter-api:5.7.0'
    )
    testRuntimeOnly(
            'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    )
}

test {
    useJUnitPlatform(){
        includeEngines 'junit-jupiter'
    }
}

apply plugin: 'kotlin'

test {
    systemProperty 'platform', project.findProperty('platform')
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1'
    implementation "io.appium:java-client:7.2.0"
//    implementation 'junit:junit:4.12'
    implementation 'junit:junit:5.7.0'
}
这是项目级的build.gradle

buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

错误消息显示了这一点<代码>实现“junit:junit:5.7.0”是一个不存在的依赖项。离开它,它可能已经起作用了。

请显示你的Gradle构建文件。将这两个文件都添加到问题中,并注释了这一行,一切正常!干杯