在 Android 项目中遇到 'Cannot resolve symbol 'InstrumentationRegistry'' 错误通常是因为缺少对 Android Testing Support Library 的引用。

为了解决这个问题,你需要在你的项目的 build.gradle 文件中添加以下依赖项:

androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

至于 'R.id.scrollable_container',它可能是在布局文件中定义的一个 ScrollView 或 RecyclerView 的 id。也可能是在代码中通过 findViewById() 方法获取到的一个 View 的 id。你需要根据具体情况来确定。

Android 项目中解决 'Cannot resolve symbol 'InstrumentationRegistry'' 错误

原文地址: https://www.cveoy.top/t/topic/ohx4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录