[英]What package should i use to replace "android.support.test.rule.ActivityTestRule" in the newest AndroidStudio?
I've been debugging a program in AndroidStudio.我一直在 AndroidStudio 中调试一个程序。 The program needs the class "ActivityTestRule" but it shows:
该程序需要 class "ActivityTestRule" 但它显示:
“Cannot resolve symbol 'ActivityTestRule' ”
“无法解析符号‘ActivityTestRule’”
-the code where ActivityTestRule is used- - 使用 ActivityTestRule 的代码 -
I'm using the newest version of AndroidStudio with the newest version of gradle.我正在使用最新版本的 AndroidStudio 和最新版本的 gradle。 It suggests that there's no android support-v7.
这表明没有 android support-v7。 So I use "androidx.test" to replace most packages under "android.support.test", but I cannot find the package to replace "android.support.test.rule.ActivityTestRule".
所以我使用“androidx.test”来替换“android.support.test”下的大多数包,但是我找不到package来替换“android.support.test.rule.ActivityTestRule”。
What should i do?我应该怎么办? (Better just change the "import" part of code)
(最好只更改代码的“导入”部分)
OK, I've solved this myself:好的,我自己解决了这个问题:
Project structure -> Add the dependency "com.android.support.test:rules:1.0.2" to app denpendencies ->Apply->Done.
In code:在代码中:
#import androidx.test.rule.ActivityTestRule;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.