android - 找不到可选库:android.test.runner
问题描述
我正在尝试遵循 android 开发人员文档的Set up project for AndroidX Test
教程(在此处找到),但出现错误unable to find optional library: android.test.runner
。
这是我的 Gradle 文件:
...
android {
...
defaultConfig {
...
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
...
useLibrary 'android.test.runner'
useLibrary 'android.test.base'
useLibrary 'android.test.mock'
}
...
dependencies {
...
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:core:1.0.0'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
androidTestImplementation 'androidx.test.ext:junit:1.0.0'
androidTestImplementation 'androidx.test.ext:truth:1.0.0'
androidTestImplementation 'com.google.truth:truth:0.42'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
}
正如你所看到的,我有android.test.runner
我的依赖项,但是当我useLibrary 'android.test.runner'
在我的 android 块中添加该行时,我得到它找不到那个库的错误......
我的 Gradle 文件有问题吗?我正在按照教程中概述的说明进行操作,所以我不知道我可能会错过什么......
解决方案
推荐阅读
- angular - 如何从用户名输入中获取特定用户的数据数组
- android - 如何为每个应用程序使用 admob ID
- c - 搜索“count”个小于“bound”的不同奇数并加起来为“sum”
- docker - Bitbucket-pipeline.yml 不读取我的 Heroku 环境变量
- docker - 如何使用 docker-compose 在 Kafka Docker 中添加更多代理
- r - 如何一次获取R中具有相同列名的所有列?
- go - 如何在beego的控制器之外获取cookie和会话
- ros - ROS setup.bash 问题,如何正确复制 ROS 工作区
- nswag - nswag studio 将模型类生成到单独的文件中
- php - 如何在 symfony 3.4 中返回 json 响应