为什么我的机器人工作室看不到我的文件的gradle?

问题描述 投票:-2回答:3

enter image description here

我收到错误=错误:

Could not find method testImplementation() for arguments [junit:junit:4.12] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
android android-gradle
3个回答
0
投票

看起来你缺少你gradle这个Android插件定义。把这一行在顶部的gradle的文件。

apply plugin: 'com.android.application'

另外,还要确保您使用了以上的Gradle 3.0版本,并有增加的gradle以下库。尝试清理并生成您更新后的gradle。

repositories {
   google()
   jcenter()
}

0
投票

因此,这是你的build.gradle(app)中出现的问题,提供解决方案。你只是从你的依赖删除所有testImplementation和androidTestImplementation。我想你也不会从那里开始发现任何问题。通常在应用的build.gradle只有库的实现应该有。来吧,做,告诉我以后你会得到什么。

dependencies{
   implementation
   // comment or remove all the testCompilations and androidTestCompilations and sync the gradle
   //add this at the end of the line, this is for compilation of the gradle
   annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}

我希望它能帮助。


0
投票

只是删除了 “testCompile '的JUnit:JUnit的:4.12'” 从文件的build.gradle:

dependencies {

 //  .......
 testCompile 'junit:junit:4.12'//remove this line 

 //.......
 }

要么

在的build.gradle文件的末尾添加此行

 repositories {
    maven { url 'http://repo1.maven.org/maven2' }
}
© www.soinside.com 2019 - 2024. All rights reserved.