嗨,我是 Kotlin 新手,我想做单元测试。 所以我添加了从这个链接获得的配置: https://blog.stylingandroid.com/junit-5-getting-started/
这是我添加的内容: 在build.gradle中
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
/** Add junit5 plugin as a buildscript dependency**/
classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.0.0-M2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
这是我的应用程序 build.gradle :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
/** Run the junit's plugin as part of the build**/
apply plugin: 'de.mannodermaus.android-junit5'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.tharwa.solid.tharwa"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
/**
Add a configuration for junit 5
**/
junitPlatform {
jupiterVersion '5.0.0-M3'
platformVersion '1.0.0-M3'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.0.0-beta1'
implementation 'com.android.support:support-v4:26.0.0-beta1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:cardview-v7:26.0.0-beta1'
// retrofit
compile "com.squareup.retrofit2:retrofit:2.3.0"
//RxAndroid
compile "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
compile "com.squareup.retrofit2:converter-gson:2.3.0"
// rxandroid
compile "io.reactivex.rxjava2:rxandroid:2.0.1"
//Gson
compile 'com.google.code.gson:gson:2.4'
// test dependencies
testCompile 'junit:junit:4.12' //A configuration for junit 5
testCompile junitJupiter()
testProvided "org.junit.vintage:junit-vintage-engine:4.12.0-M3"
testImplementation "org.mockito:mockito-core:2.+"
testImplementation 'android.arch.core:core-testing:1.0.0-rc1'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
一旦我将项目与 Gradle 文件同步,我总是收到此错误:
Error:No such property: javaOuptuts for class: com.android.build.gradle.internal.scope.VariantScopeImpl
Gradle sync failed: No such property: javaOuptuts for class: com.android.build.gradle.internal.scope.VariantScopeImpl
Consult IDE log for more details (Help | Show Log) (11s 191ms)
我的版本是 android 3.0.1。 我已经搜索并尝试了几件事,但它对我不起作用。 请有人帮忙吗?
最佳答案
关于android - 如何修复错误 :No such property: javaOuptuts for class: com. android.build.gradle.internal.scope.VariantScopeImpl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49203559/