android - 如何修复错误 :No such property: javaOuptuts for class: com. android.build.gradle.internal.scope.VariantScopeImpl

标签 android junit5

嗨,我是 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。 我已经搜索并尝试了几件事,但它对我不起作用。 请有人帮忙吗?

最佳答案

enter image description here

当我在工作室升级我的 gradle 时,发生了一个错误。我进入了它正在使用的无法升级到的版本的项目设置。我将其降级回升级前使用的版本,然后它再次开始工作。

关于android - 如何修复错误 :No such property: javaOuptuts for class: com. android.build.gradle.internal.scope.VariantScopeImpl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49203559/

相关文章:

android - 尽管需要改造 2.0,但值(value)缺失

android - 获取相同位置的数据并将其显示在 TextView 中

android - 在 ListView 中启用选择

java - 如何将 Serenity 与 Junit5 结合使用?

java - 为什么在我什至不使用参数化测试时出现 ParameterResolutionException?

java - TabPagerIndicator 与抽屉导航出错

java - 所有测试类中的所有测试终止后,在 junit 5 中运行代码

maven - 有什么方法可以在故障保护下并行运行 JUnit 5 集成测试吗?

java - 在 JUnit Jupiter 中使用自定义组合注释时获取 @Autowired bean 的 NPE

android - 如何在偏好 Activity 中使用切换/切换按钮