java - Kotlin 单元测试无法解决任何问题
问题描述
我已经用 kotlin 构建了一个应用程序,一切正常,然后我进行了一些单元测试,IDE 没有显示错误,但是当我运行测试时,构建失败并说:
cannot access built-in declaration '' Ensure that you have a dependency on the Kotlin standard library
应用等级:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation "org.jetbrains.anko:anko:0.10.8"
implementation "org.jetbrains.anko:anko-design:0.10.8"
implementation "org.jetbrains.anko:anko-recyclerview-v7:0.10.8"
implementation "org.jetbrains.anko:anko-recyclerview-v7-coroutines:0.10.8"
implementation "org.jetbrains.anko:anko-sqlite:0.10.8"
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
//noinspection LifecycleAnnotationProcessorWithJava8
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.okhttp3:okhttp:3.14.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.9'
implementation 'net.sourceforge.streamsupport:streamsupport:1.7.0'
testImplementation 'junit:junit:4.12'
testImplementation "org.mockito:mockito-inline:2.27.0"
testImplementation 'org.mockito:mockito-core:2.27.0'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.2.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
项目等级:
buildscript {
ext.kotlin_version = '1.3.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}}
解决方案
推荐阅读
- javascript - 从控制面板按钮中删除边框
- c# - 如何从 Xamarin 中为 Android 密钥库生成的 KeyPair 获取指数/模数
- swift - 如何在运行时修改view.alphaValue并生效
- google-maps - 如何将当前位置数据发送到另一个活动?(科特林)
- javascript - 有没有办法在数据表的每一行上添加按钮?[反应js]
- java - 如何使用结果集?
- ios - 是否可以编写一个模拟 USB 键盘的 iPhone 应用程序?
- django - 使用函数更改 ModelSerializer 字段键
- java - 试图在邮递员上将日期作为路径变量传递但是我得到错误
- java - 每次进行工作区搜索后,Eclipse 都会开始构建工作区