我刚刚更新了我的android工作室并创建了新项目,但我现在收到此错误:
ERROR: Could not find method testImplementation() for arguments [junit:junit:4.12] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
在这里我的gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.blurbnow.emirhan.heartkeeper_test2"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
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'
}
我搜索它,但我找不到任何解决方案。如果有人能提供帮助,我会很高兴。谢谢。
即使不能完整回答您的问题,我找到了解决此问题的方法: 转到项目结构>项目>并更改 Gradle版本:4.6 Android插件版本:3.2.1 根据这里给出的表格: https://developer.android.com/studio/releases/gradle-plugin#updating-gradle 编辑:它在第一次尝试时没有工作,但是在我改变之后我进入了它工作。感谢Mehmet Erdogdu!
testİmplementation 'junit:junit:4.12'
androidTestİmplementation 'com.android.support.test:runner:1.0.2'
androidTestİmplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
或某些国家有这个问题另一个选择可能是这对你有帮助
在Gradle Scripts> build.gradle(app:Module)中
testİmplementation 'junit:junit:4.12'
androidTestİmplementation 'com.android.support.test:runner:1.0.2'
androidTestİmplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
改变它testImplementation
- > testİmplementation
如果您更新了Studio 3.3.0,则会看到此错误。你是否用包括Kotlin lang编写你的项目检查你的lang版本。
文件>设置>插件>并搜索Kotlin。现在从右侧面板检查版本
之后转到Gradle Scripts> build.gradle检查版本,如果它不相同。更改。像我这样的
//ext.开OT林_version = '1.2.71'
ext.kotlin_version ='1.3.11'
我修复了这个错误。
--Mehmet
// 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'
评论这些线 然后单击“make project”按钮(ctrl + F9) 最后点击“再试一次”这个解决方案对我有用。希望能帮助到你
只是换另一种选择,将系统语言设置为英语然后创建一个新项目对我有用。
据我所知,问题是关于一些国家。比如土耳其键盘。
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:1.0.2'
androidTestCompile'com.android.support.test.espresso:espresso-core:3.0.2'
要么
testİmplementation 'junit:junit:4.12'
androidTestİmplementation 'com.android.support.test:runner:1.0.2'
androidTestİmplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
为我工作。