too*_*o42 14 android ui-testing android-espresso
我尝试运行ui测试时遇到以下错误.
/Users/etiennelawlor/workspace/MovieHub/app/src/androidTest/java/com/etiennelawlor/moviehub/MoviesFragmentTest.java
Error:(34, 28) error: cannot access AppCompatActivity class file for android.support.v7.app.AppCompatActivity not found
Error:(34, 58) error: cannot infer type arguments for ActivityTestRule<>
Error:(41, 41) error: cannot access IdlingResource class file for android.support.test.espresso.IdlingResource not found
Error:(51, 40) error: cannot access RecyclerView class file for android.support.v7.widget.RecyclerView not found
Error:Execution failed for task ‘:app:compileDebugAndroidTestJavaWithJavac’.
Compilation failed; see the compiler error output for details.
Run Code Online (Sandbox Code Playgroud)
这是我的测试类:https://github.com/lawloretienne/MovieHub/blob/226492727e4d467b337ed4b689edb05eec0368c2/app/src/androidTest/java/com/etiennelawlor/moviehub/MoviesFragmentTest.java
我错过了什么吗?
这是我的Gradle文件
https://github.com/lawloretienne/MovieHub/blob/master/app/build.gradle
Be_*_*ive 14
在build.gradle明确排除生产APK,这反过来又限制着仪器的apk的COMPAT库的依赖关系.我不确定为什么这是必需的,因为我从未经历过评论中提到的那个bug.
基本上,删除此块:
configurations.implementation.dependencies.all { implementationDependency ->
println "Excluding implementation dependency: ${implementationDependency.getName()}"
configurations.androidTestImplementation.dependencies.all { androidTestImplementationDependency ->
configurations.androidTestImplementation.exclude module: "${implementationDependency.getName()}"
}
}
Run Code Online (Sandbox Code Playgroud)
会解决它.
| 归档时间: |
|
| 查看次数: |
929 次 |
| 最近记录: |