找不到参数的方法testImplementation()[junit:junit:4.12]

O.U*_*fuk 8 junit android build gradle

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha06'
    implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha06'
    implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha06'
    implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha06'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Run Code Online (Sandbox Code Playgroud)

这是我的build.gradle文件,我尝试了很多方法,但我无法解决这个问题,当我启动Android Studio并且gradle开始构建项目时,Android Studio抛出此错误我该如何解决?(我是Android新手)

找不到类型对象的testImplementation()参数方法[junit:junit:4.12]org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Nec*_*cer 21

这是谷歌的错.你需要使用你的国家信件.所以使用'İ'而不是'我'.

test?mplementation  'junit:junit:4.12'
androidTest?mplementation  'androidx.test:runner:1.1.1'
androidTest?mplementation  'androidx.test.espresso:espresso-core:3.1.1'
Run Code Online (Sandbox Code Playgroud)

  • 谢谢。奇迹般有效。显然,土耳其语İ问题。如今,每个人都对AI感到兴奋,但是人类仍然没有解决编码问题:( (7认同)
  • 我不敢相信我们在 2020 年仍然遇到这个问题:/ (4认同)
  • 这个答案应该被接受。感谢分享。这个问题让我很生气。 (3认同)
  • 这不会使您的项目与世界各地的任何其他开发人员不兼容吗?我不敢相信这是唯一的解决方案。而且我不敢相信我们仍然遇到 Java 大写/小写问题。我在任何地方都使用 en_us 但显然我不应该这样做。 (2认同)

gma*_*ull 6

好吧,我知道这不是最好的解决方案,但这是行得通的。我只是将这些行注释掉了:

//testImplementation "junit:junit:4.12"
//testImplementation "org.robolectric:robolectric:3.1.2"
Run Code Online (Sandbox Code Playgroud)

希望对您有帮助=)